aboutsummaryrefslogtreecommitdiff
path: root/scss
diff options
context:
space:
mode:
authorMark Otto <[email protected]>2016-07-23 17:12:43 -0700
committerMark Otto <[email protected]>2016-07-23 17:12:43 -0700
commita8879c8f82ec3debb8e225844dc4561e2900beda (patch)
tree4f9c784487268e676afa7e92aeebc63529e9a531 /scss
parente613415a76daa4e0d6bb0d3dfa0dccbc073e778d (diff)
downloadbootstrap-a8879c8f82ec3debb8e225844dc4561e2900beda.tar.xz
bootstrap-a8879c8f82ec3debb8e225844dc4561e2900beda.zip
Follow-up to #19099 for grid fixes
- Restores two-mixin approach to generating semantic grid columns (now with 'make-col-ready' and 'make-col') - Removes need for .col-xs-12 by restoring the mass list of all grid tier classes to set position, min-height, and padding - Adds an initial 'width: 100%' to flexbox grid column prep (later overridden by the column sizing in 'flex' shorthand or 'width') to prevent flexbox columns from collapsing in lower viewports
Diffstat (limited to 'scss')
-rw-r--r--scss/mixins/_grid-framework.scss32
-rw-r--r--scss/mixins/_grid.scss13
2 files changed, 32 insertions, 13 deletions
diff --git a/scss/mixins/_grid-framework.scss b/scss/mixins/_grid-framework.scss
index cb25be92a..4b69c2761 100644
--- a/scss/mixins/_grid-framework.scss
+++ b/scss/mixins/_grid-framework.scss
@@ -4,22 +4,32 @@
// any value of `$grid-columns`.
@mixin make-grid-columns($columns: $grid-columns, $gutter: $grid-gutter-width, $breakpoints: $grid-breakpoints) {
+
+ // Common properties for all breakpoints
+ %grid-column {
+ position: relative;
+ // Prevent columns from collapsing when empty
+ min-height: 1px;
+ // Inner gutter via padding
+ padding-left: ($gutter / 2);
+ padding-right: ($gutter / 2);
+
+ @if $enable-flex {
+ width: 100%;
+ }
+ }
+
$breakpoint-counter: 0;
@each $breakpoint in map-keys($breakpoints) {
$breakpoint-counter: ($breakpoint-counter + 1);
- @include media-breakpoint-up($breakpoint, $breakpoints) {
- @if $enable-flex {
- .col-#{$breakpoint} {
- position: relative;
- flex-basis: 0;
- flex-grow: 1;
- max-width: 100%;
- min-height: 1px;
- padding-right: ($gutter / 2);
- padding-left: ($gutter / 2);
- }
+
+ @for $i from 1 through $columns {
+ .col-#{$breakpoint}-#{$i} {
+ @extend %grid-column;
}
+ }
+ @include media-breakpoint-up($breakpoint, $breakpoints) {
@for $i from 1 through $columns {
.col-#{$breakpoint}-#{$i} {
@include make-col($i, $columns, $gutter);
diff --git a/scss/mixins/_grid.scss b/scss/mixins/_grid.scss
index 3ba4f43bc..87f112278 100644
--- a/scss/mixins/_grid.scss
+++ b/scss/mixins/_grid.scss
@@ -33,12 +33,21 @@
margin-right: ($gutter / -2);
}
-@mixin make-col($size, $columns: $grid-columns, $gutter: $grid-gutter-width) {
+@mixin make-col-ready($size, $columns: $grid-columns, $gutter: $grid-gutter-width) {
position: relative;
- min-height: 1px;
+ min-height: 1px; // Prevent collapsing
padding-right: ($gutter / 2);
padding-left: ($gutter / 2);
+ // Prevent columns from becoming too narrow when at smaller grid tiers by
+ // always setting `width: 100%;`. This works because we use `flex` values
+ // later on to override this initial width.
+ @if $enable-flex {
+ width: 100%;
+ }
+}
+
+@mixin make-col($size, $columns: $grid-columns, $gutter: $grid-gutter-width) {
@if $enable-flex {
flex: 0 0 percentage($size / $columns);
// Add a `max-width` to ensure content within each column does not blow out