--card-color: inherit,
--card-bg: var(--bg-body),
--card-img-overlay-padding: #{$spacer},
- --card-group-margin: #{$grid-gutter-width * .5},
+ --card-group-margin: #{$grid-gutter-x * .5},
--card-body-gap: #{$spacer * .5},
),
$card-tokens
// Set the number of columns and specify the width of the gutters.
$grid-columns: 12 !default;
-$grid-gutter-width: 1.5rem !default;
+$grid-gutter-x: 1.5rem !default;
+$grid-gutter-y: 0 !default;
$grid-row-columns: 6 !default;
$gutters: $spacers !default;
) !default;
// scss-docs-end container-max-widths
-$container-padding-x: $grid-gutter-width !default;
+$container-padding-x: $grid-gutter-x !default;
$utilities: () !default;
.grid {
--columns: #{$grid-columns};
--rows: 1;
- --gap: #{$grid-gutter-width};
+ --gap: #{$grid-gutter-x};
display: grid;
grid-template-rows: repeat(var(--rows), 1fr);
}
.grid-fill {
- --gap: #{$grid-gutter-width};
+ --gap: #{$grid-gutter-x};
display: grid;
grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
//
// Generate semantic grid columns with these mixins.
-@mixin make-row($gutter: $grid-gutter-width) {
- --gutter-x: #{$gutter};
- --gutter-y: 0;
+@mixin make-row($gutter-x: $grid-gutter-x, $gutter-y: $grid-gutter-y) {
+ --gutter-x: #{$gutter-x};
+ --gutter-y: #{$gutter-y};
display: flex;
flex-wrap: wrap;
// TODO: Revisit calc order after https://github.com/react-bootstrap/react-bootstrap/issues/6039 is fixed
// Used only by Bootstrap to generate the correct number of grid classes given
// any value of `$grid-columns`.
-@mixin make-grid-columns($columns: $grid-columns, $gutter: $grid-gutter-width, $breakpoints: $breakpoints) {
+@mixin make-grid-columns($columns: $grid-columns, $gutter: $grid-gutter-x, $breakpoints: $breakpoints) {
@each $breakpoint in map.keys($breakpoints) {
$infix: breakpoint-infix($breakpoint, $breakpoints);
## Sass
-One limitation of the CSS Grid is that our default classes are still generated by two Sass variables, `$grid-columns` and `$grid-gutter-width`. This effectively predetermines the number of classes generated in our compiled CSS. You have two options here:
+One limitation of the CSS Grid is that our default classes are still generated by two Sass variables, `$grid-columns` and `$grid-gutter-x`. This effectively predetermines the number of classes generated in our compiled CSS. You have two options here:
- Modify those default Sass variables and recompile your CSS.
- Use inline or custom styles to augment the provided classes.
### Sass variables
-Variables and maps determine the number of columns, the gutter width, and the media query point at which to begin floating columns. We use these to generate the predefined grid classes documented above, as well as for the custom mixins listed below.
+Variables and maps determine the number of columns, the horizontal and vertical gutter size, and the media query point at which to begin floating columns. We use these to generate the predefined grid classes documented above, as well as for the custom mixins listed below.
```scss
-$grid-columns: 12;
-$grid-gutter-width: 1.5rem;
-$grid-row-columns: 6;
+$grid-columns: 12;
+$grid-gutter-x: 1.5rem;
+$grid-gutter-y: 0;
+$grid-row-columns: 6;
```
<ScssDocs name="breakpoints" file="scss/_config.scss" />
```scss
// Creates a wrapper for a series of columns
-@include make-row();
+@include make-row(); // default values for both horizontal and vertical gutters
+@include make-row(2rem); // 2rem for horizontal gutters and default value for vertical gutters
+@include make-row(2rem, 1rem); // 2rem for horizontal gutters and 1rem for vertical gutters
+@include make-row($gutter-y: 1rem); // default value for horizontal gutters and 1rem for vertical gutters
// Make the element grid-ready (applying everything but the width)
@include make-col-ready();
### Columns and gutters
-The number of grid columns can be modified via Sass variables. `$grid-columns` is used to generate the widths (in percent) of each individual column while `$grid-gutter-width` sets the width for the column gutters. `$grid-row-columns` is used to set the maximum number of columns of `.row-cols-*`, any number over this limit is ignored.
+The number of grid columns can be modified via Sass variables. `$grid-columns` is used to generate the widths (in percent) of each individual column. `$grid-gutter-x` and `$grid-gutter-y` set the horizontal and vertical gutter sizes. `$grid-row-columns` is used to set the maximum number of columns of `.row-cols-*`, any number over this limit is ignored.
```scss
$grid-columns: 12 !default;
-$grid-gutter-width: 1.5rem !default;
+$grid-gutter-x: 1.5rem !default;
+$grid-gutter-y: 0 !default;
$grid-row-columns: 6 !default;
```
Classes are built from the `$gutters` Sass map which is inherited from the `$spacers` Sass map.
```scss
-$grid-gutter-width: 1.5rem;
+$grid-gutter-x: 1.5rem;
$gutters: (
0: 0,
1: $spacer * .25,
display: grid;
grid-template-areas: "sidebar main";
grid-template-columns: 1fr 5fr;
- gap: $grid-gutter-width;
+ gap: $grid-gutter-x;
}
@include media-breakpoint-up(xl) {