Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add equal column mixin #32155

Merged
merged 3 commits into from Apr 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 8 additions & 3 deletions scss/mixins/_grid.scss
Expand Up @@ -26,9 +26,14 @@
margin-top: var(--#{$variable-prefix}gutter-y);
}

@mixin make-col($size, $columns: $grid-columns) {
flex: 0 0 auto;
width: percentage($size / $columns);
@mixin make-col($size: false, $columns: $grid-columns) {
@if $size {
flex: 0 0 auto;
width: percentage($size / $columns);
} @else {
flex: 1 1 0;
max-width: 100%;
}
}

@mixin make-col-auto() {
Expand Down
3 changes: 3 additions & 0 deletions site/content/docs/5.0/layout/grid.md
Expand Up @@ -434,6 +434,9 @@ Mixins are used in conjunction with the grid variables to generate semantic CSS

// Make the element grid-ready (applying everything but the width)
@include make-col-ready();

// Without optional size values, the mixin will create equal columns (similar to using .col)
@include make-col();
@include make-col($size, $columns: $grid-columns);

// Get fancy by offsetting, or changing the sort order
Expand Down