aboutsummaryrefslogtreecommitdiff
path: root/scss
diff options
context:
space:
mode:
authorMark Otto <[email protected]>2019-07-23 23:00:29 -0700
committerMark Otto <[email protected]>2019-08-30 13:07:27 -0700
commitcc248791b0f260aa6e0505a0aa7c3faeb1cbc797 (patch)
tree926672156b3b47911e4bcb3e471dc93fe889c719 /scss
parentdb692d02d555a66219283d5e2150a681fafee1e6 (diff)
downloadbootstrap-cc248791b0f260aa6e0505a0aa7c3faeb1cbc797.tar.xz
bootstrap-cc248791b0f260aa6e0505a0aa7c3faeb1cbc797.zip
Cleanup
- Rename and move the variable to variables file - Move code to the grid file - Use the mixin to generate our own classes - Wrap in a grid classes enabled conditional - Document the mixin
Diffstat (limited to 'scss')
-rw-r--r--scss/_card.scss12
-rw-r--r--scss/_grid.scss10
-rw-r--r--scss/_variables.scss1
-rw-r--r--scss/mixins/_grid.scss11
4 files changed, 22 insertions, 12 deletions
diff --git a/scss/_card.scss b/scss/_card.scss
index 938585926..f68855c56 100644
--- a/scss/_card.scss
+++ b/scss/_card.scss
@@ -175,18 +175,6 @@
}
}
-$row-columns: 6 !default;
-
-@each $breakpoint in map-keys($grid-breakpoints) {
- $infix: breakpoint-infix($breakpoint, $grid-breakpoints);
-
- @for $i from 1 through $row-columns {
- .row-cols#{$infix}-#{$i} > [class^="col"] {
- flex: 0 0 calc(100% / #{$i});
- }
- }
-}
-
//
// Card groups
diff --git a/scss/_grid.scss b/scss/_grid.scss
index d36ee75d8..5f25e38f1 100644
--- a/scss/_grid.scss
+++ b/scss/_grid.scss
@@ -46,6 +46,16 @@
@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/_variables.scss b/scss/_variables.scss
index 850344aac..e5b1a797d 100644
--- a/scss/_variables.scss
+++ b/scss/_variables.scss
@@ -215,6 +215,7 @@ $container-max-widths: (
$grid-columns: 12 !default;
$grid-gutter-width: 30px !default;
+$grid-row-columns: 6 !default;
// Container padding
diff --git a/scss/mixins/_grid.scss b/scss/mixins/_grid.scss
index b85e31bc0..f0b6c5270 100644
--- a/scss/mixins/_grid.scss
+++ b/scss/mixins/_grid.scss
@@ -49,3 +49,14 @@
$num: $size / $columns;
margin-left: if($num == 0, 0, percentage($num));
}
+
+// Row columns
+//
+// Specify on a parent element(e.g., .row) to force immediate children into NN
+// 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});
+ }
+}