Grid
Simple display grid and inline grid utilities with module mixins for responsive modifiers.
Utilities (anchor)
Utility class | Property values |
---|---|
.grid | display: grid |
.grid-inline | display: inline-grid |
.grid-reset | display: initial |
Responsive mixins (anchor)
Responsive modifier mixins are provided to include where required in custom breakpoints, the utilities available use the following modifier class naming convention:
.grid
.grid-xxl
.grid-xl
.grid-lg
.grid-md
.grid-sm
.grid-xs
.grid-xxs
Using the module (anchor)
Load StyleMods as demonstrated (change file path as required) then include the Sass mixin anywhere below.
@use "stylemods/scss" as *;
@include grid-css;
@media (width <= 480px) {
@include grid-sm-css;
}
See the using modules page for more information including how to compile the modules in cascade layers and include and reuse them in multiple source files.
Using the framework (anchor)
Using the recommended custom setup enable the styles (and required breakpoints) in an overrides document:
@use "stylemods/scss/configuration" as *;
$enable-grid: true;
$enable-grid-sm: true;
Include the overrides and the framework styles with your custom document for compiling the framework:
@use "overrides";
@use "stylemods/scss/stylemods";
See using the framework for more information including how the styles can also be compiled within cascade layers.
Source code (anchor)
The modules and framework use the same source code, see Sass maps to learn how to customize the values below.
grid.scss
// ----------------------------------------------------------
// Grid
// ----------------------------------------------------------
$grid-values: (
"grid": grid,
"grid-inline": inline-grid,
"grid-reset": initial,
) !default;
// Grid utilities
@mixin grid-css {
@each $name, $value in $grid-values {
.#{$name} {
display: #{$value};
}
}
}
// XXL
@mixin grid-xxl-css {
@each $name, $value in $grid-values {
.#{$name}-xxl {
display: #{$value};
}
}
}
// XL
@mixin grid-xl-css {
@each $name, $value in $grid-values {
.#{$name}-xl {
display: #{$value};
}
}
}
// LG
@mixin grid-lg-css {
@each $name, $value in $grid-values {
.#{$name}-lg {
display: #{$value};
}
}
}
// MD
@mixin grid-md-css {
@each $name, $value in $grid-values {
.#{$name}-md {
display: #{$value};
}
}
}
// SM
@mixin grid-sm-css {
@each $name, $value in $grid-values {
.#{$name}-sm {
display: #{$value};
}
}
}
// XS
@mixin grid-xs-css {
@each $name, $value in $grid-values {
.#{$name}-xs {
display: #{$value};
}
}
}
// XXS
@mixin grid-xxs-css {
@each $name, $value in $grid-values {
.#{$name}-xxs {
display: #{$value};
}
}
}