Skip to content

Instantly share code, notes, and snippets.

@lgk-bsw
Created August 14, 2023 10:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lgk-bsw/ee32fad9535b60ad0f0fb2bcd53411e1 to your computer and use it in GitHub Desktop.
Save lgk-bsw/ee32fad9535b60ad0f0fb2bcd53411e1 to your computer and use it in GitHub Desktop.
Bootstrap Grid System Elements Queries
@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