1
0
Fork 0
mirror of https://github.com/twbs/bootstrap.git synced 2022-11-09 12:25:43 -05:00

Allow override default col width

This commit is contained in:
ysds 2019-08-28 23:37:39 +09:00 committed by Mark Otto
parent cc248791b0
commit ebfeaa4ad1
4 changed files with 23 additions and 12 deletions

View file

@ -46,16 +46,6 @@
@include make-row(); @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 // Remove the negative margin from default .row, then the horizontal padding
// from all immediate children columns (to prevent runaway style inheritance). // from all immediate children columns (to prevent runaway style inheritance).
.no-gutters { .no-gutters {

View file

@ -33,6 +33,13 @@
flex-grow: 1; flex-grow: 1;
max-width: 100%; max-width: 100%;
} }
@for $i from 1 through $grid-row-columns {
.row-cols#{$infix}-#{$i} {
@include row-cols($i);
}
}
.col#{$infix}-auto { .col#{$infix}-auto {
flex: 0 0 auto; flex: 0 0 auto;
width: auto; width: auto;

View file

@ -56,7 +56,8 @@
// numberof columns. Supports wrapping to new lines, but does not do a Masonry // numberof columns. Supports wrapping to new lines, but does not do a Masonry
// style grid. // style grid.
@mixin row-cols($count) { @mixin row-cols($count) {
& > [class^="col"] { & > * {
flex: 0 0 calc(100% / #{$count}); flex: 0 0 100% / $count;
max-width: 100% / $count;
} }
} }

View file

@ -369,6 +369,19 @@ Use these row columns classes to quickly create basic grid layouts or to control
{{< /example >}} {{< /example >}}
</div> </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()`: You can also use the accompanying Sass mixin, `row-cols()`:
{{< highlight scss >}} {{< highlight scss >}}