mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-27 15:19:52 +02:00
v5.1: Add optional CSS grid (#31813)
This commit is contained in:
@@ -12,6 +12,40 @@
|
||||
}
|
||||
}
|
||||
|
||||
@mixin make-cssgrid($columns: $grid-columns, $breakpoints: $grid-breakpoints) {
|
||||
@each $breakpoint in map-keys($breakpoints) {
|
||||
$infix: breakpoint-infix($breakpoint, $breakpoints);
|
||||
|
||||
@include media-breakpoint-up($breakpoint, $breakpoints) {
|
||||
@if $columns > 0 {
|
||||
@for $i from 1 through $columns {
|
||||
.g-col#{$infix}-#{$i} {
|
||||
grid-column: auto / span $i;
|
||||
}
|
||||
}
|
||||
|
||||
// `$columns - 1` because offsetting by the width of an entire row isn't possible
|
||||
@for $i from 0 through ($columns - 1) {
|
||||
.g-start#{$infix}-#{$i} {
|
||||
grid-column-start: $i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@if $enable-cssgrid {
|
||||
.grid {
|
||||
display: grid;
|
||||
grid-template-rows: repeat(var(--#{$variable-prefix}rows, 1), 1fr);
|
||||
grid-template-columns: repeat(var(--#{$variable-prefix}columns, #{$grid-columns}), 1fr);
|
||||
gap: var(--#{$variable-prefix}gap, #{$grid-gutter-width});
|
||||
|
||||
@include make-cssgrid();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Columns
|
||||
//
|
||||
|
@@ -221,6 +221,7 @@ $enable-transitions: true !default;
|
||||
$enable-reduced-motion: true !default;
|
||||
$enable-smooth-scroll: true !default;
|
||||
$enable-grid-classes: true !default;
|
||||
$enable-cssgrid: false !default;
|
||||
$enable-button-pointers: true !default;
|
||||
$enable-rfs: true !default;
|
||||
$enable-validation-icons: true !default;
|
||||
|
Reference in New Issue
Block a user