mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-25 06:21:26 +02:00
Clean up a couple CSS Grid issues (#34572)
- Moves the make-cssgrid() mixin to the grid mixins stylesheet - Updates the g-start-* classes to start at 1 instead of 0 as 0 is an invalid value (fixes #34399) Co-authored-by: XhmikosR <xhmikosr@gmail.com>
This commit is contained in:
@@ -12,29 +12,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
@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;
|
||||
|
@@ -130,3 +130,27 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
||||
|
||||
// Start with `1` because `0` is and invalid value.
|
||||
// Ends with `$columns - 1` because offsetting by the width of an entire row isn't possible.
|
||||
@for $i from 1 through ($columns - 1) {
|
||||
.g-start#{$infix}-#{$i} {
|
||||
grid-column-start: $i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user