Created
August 14, 2023 10:29
-
-
Save lgk-bsw/ee32fad9535b60ad0f0fb2bcd53411e1 to your computer and use it in GitHub Desktop.
Bootstrap Grid System Elements Queries
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@import "~bootstrap/scss/mixins"; | |
/** | |
CSS Elements Queries (https://github.com/marcj/css-element-queries) support for Bootstrap's Grid System. | |
Just add the class name ".element-query" to the parent element. | |
*/ | |
@mixin make-grid-columns-eq( | |
$columns: $grid-columns, | |
$gutter: $grid-gutter-width, | |
$breakpoints: $grid-breakpoints | |
) { | |
@each $breakpoint in map-keys($breakpoints) { | |
$infix: breakpoint-infix($breakpoint, $breakpoints); | |
@for $i from 1 through $columns { | |
.col#{$infix}-#{$i} { | |
flex: initial; | |
max-width: initial; | |
} | |
} | |
&[min-width~="#{breakpoint-min($breakpoint, $breakpoints)}"] { | |
@for $i from 1 through $columns { | |
.col#{$infix}-#{$i} { | |
@include make-col($i, $columns); | |
} | |
} | |
} | |
} | |
} | |
.element-query { | |
@include make-grid-columns-eq(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment