diff options
| author | ysds <[email protected]> | 2019-08-28 23:37:39 +0900 |
|---|---|---|
| committer | Mark Otto <[email protected]> | 2019-08-30 13:07:27 -0700 |
| commit | ebfeaa4ad18aa67c8ff91ff483f1f3634b2afc85 (patch) | |
| tree | e908ca120f07d69034b31926c47e39a7c55225db | |
| parent | cc248791b0f260aa6e0505a0aa7c3faeb1cbc797 (diff) | |
| download | bootstrap-ebfeaa4ad18aa67c8ff91ff483f1f3634b2afc85.tar.xz bootstrap-ebfeaa4ad18aa67c8ff91ff483f1f3634b2afc85.zip | |
Allow override default col width
| -rw-r--r-- | scss/_grid.scss | 10 | ||||
| -rw-r--r-- | scss/mixins/_grid-framework.scss | 7 | ||||
| -rw-r--r-- | scss/mixins/_grid.scss | 5 | ||||
| -rw-r--r-- | site/content/docs/4.3/layout/grid.md | 13 |
4 files changed, 23 insertions, 12 deletions
diff --git a/scss/_grid.scss b/scss/_grid.scss index 5f25e38f1..d36ee75d8 100644 --- a/scss/_grid.scss +++ b/scss/_grid.scss @@ -46,16 +46,6 @@ @include make-row(); } - @each $breakpoint in map-keys($grid-breakpoints) { - $infix: breakpoint-infix($breakpoint, $grid-breakpoints); - - @for $i from 1 through $grid-row-columns { - .row-cols#{$infix}-#{$i} { - @include row-cols($i); - } - } - } - // Remove the negative margin from default .row, then the horizontal padding // from all immediate children columns (to prevent runaway style inheritance). .no-gutters { diff --git a/scss/mixins/_grid-framework.scss b/scss/mixins/_grid-framework.scss index 9aeafc06e..567c04a73 100644 --- a/scss/mixins/_grid-framework.scss +++ b/scss/mixins/_grid-framework.scss @@ -33,6 +33,13 @@ flex-grow: 1; max-width: 100%; } + + @for $i from 1 through $grid-row-columns { + .row-cols#{$infix}-#{$i} { + @include row-cols($i); + } + } + .col#{$infix}-auto { flex: 0 0 auto; width: auto; diff --git a/scss/mixins/_grid.scss b/scss/mixins/_grid.scss index f0b6c5270..5918df1af 100644 --- a/scss/mixins/_grid.scss +++ b/scss/mixins/_grid.scss @@ -56,7 +56,8 @@ // numberof columns. Supports wrapping to new lines, but does not do a Masonry // style grid. @mixin row-cols($count) { - & > [class^="col"] { - flex: 0 0 calc(100% / #{$count}); + & > * { + flex: 0 0 100% / $count; + max-width: 100% / $count; } } diff --git a/site/content/docs/4.3/layout/grid.md b/site/content/docs/4.3/layout/grid.md index 2d839968f..454dcd4ae 100644 --- a/site/content/docs/4.3/layout/grid.md +++ b/site/content/docs/4.3/layout/grid.md @@ -369,6 +369,19 @@ Use these row columns classes to quickly create basic grid layouts or to control {{< /example >}} </div> +<div class="bd-example-row"> +{{< example >}} +<div class="container"> + <div class="row row-cols-4"> + <div class="col">Column</div> + <div class="col">Column</div> + <div class="col-6">Column</div> + <div class="col">Column</div> + </div> +</div> +{{< /example >}} +</div> + You can also use the accompanying Sass mixin, `row-cols()`: {{< highlight scss >}} |
