Skip to content

Commit

Permalink
Add equal column mixin (#32155)
Browse files Browse the repository at this point in the history
  • Loading branch information
cfxd committed Apr 6, 2021
1 parent 317c2cd commit 0c56749
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
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

0 comments on commit 0c56749

Please sign in to comment.