Sizes
A basic set of sizing utilities with module mixins for responsive modifiers.
Examples
.width {
inline-size: var(--width);
}
.min-width {
min-inline-size: var(--min-width);
}
.max-width {
max-inline-size: var(--max-width);
}
.w-auto {
inline-size: auto;
}
.w-100 {
inline-size: 100%;
}
.w-100-min {
min-inline-size: 100%;
}
.w-100-max {
max-inline-size: 100%;
}
.w-100vw {
inline-size: 100vw;
}
.w-vw-calc {
inline-size: calc(100vw - var(--width));
}
.height {
block-size: var(--height);
}
.min-height {
min-block-size: var(--min-height);
}
.max-height {
max-block-size: var(--max-height);
}
.h-auto {
block-size: auto;
}
.h-100 {
block-size: 100%;
}
.h-100-min {
min-block-size: 100%;
}
.h-100-max {
max-block-size: 100%;
}
.h-100vh {
block-size: 100vh;
}
.h-vh-calc {
block-size: calc(100vh - var(--height));
}
Responsive mixins
Responsive modifier mixins are also provided with no pre-defined breakpoints so they can be included as modules with custom SCSS breakpoints, or alternatively enabled in the breakpoints included with the framework (see below). The following demonstrates the static and responsive names for the .w-auto
utility.
.w-auto
.w-auto-xl
.w-auto-lg
.w-auto-md
.w-auto-sm
.w-auto-xs
Using the module
Add the sassmods.scss
to your custom styles as below then include the Sass mixin(s) anywhere below.
custom.scss
@use "sassmods/scss/sassmods" as *;
@include sizes-css;
// Example breakpoint
@media (max-width: 480px) {
@include sizes-sm-css;
}
Source
_sizes.scss
// ------------------------------------------------------------
// Sizes
// ------------------------------------------------------------
@mixin sizes-css {
.width {
inline-size: var(--width);
}
.min-width {
min-inline-size: var(--min-width);
}
.max-width {
max-inline-size: var(--max-width);
}
.w-auto {
inline-size: auto;
}
.w-100 {
inline-size: 100%;
}
.w-100-min {
min-inline-size: 100%;
}
.w-100-max {
max-inline-size: 100%;
}
.w-100vw {
inline-size: 100vw;
}
.w-vw-calc {
inline-size: calc(100vw - var(--width));
}
.height {
block-size: var(--height);
}
.min-height {
min-block-size: var(--min-height);
}
.max-height {
max-block-size: var(--max-height);
}
.h-auto {
block-size: auto;
}
.h-100 {
block-size: 100%;
}
.h-100-min {
min-block-size: 100%;
}
.h-100-max {
max-block-size: 100%;
}
.h-100vh {
block-size: 100vh;
}
.h-vh-calc {
block-size: calc(100vh - var(--height));
}
}
@mixin sizes-xl-css {
.w-auto-xl {
inline-size: auto;
}
.w-100-xl {
inline-size: 100%;
}
.w-100-min-xl {
min-inline-size: 100%;
}
.w-100-max-xl {
max-inline-size: 100%;
}
.w-100vw-xl {
inline-size: 100vw;
}
.w-vw-calc-xl {
inline-size: calc(100vw - var(--width));
}
.h-auto-xl {
block-size: auto;
}
.h-100-xl {
block-size: 100%;
}
.h-100-min-xl {
min-block-size: 100%;
}
.h-100-max-xl {
max-block-size: 100%;
}
.h-100vh-xl {
block-size: 100vh;
}
.h-vh-calc-xl {
block-size: calc(100vh - var(--height));
}
}
@mixin sizes-lg-css {
.w-auto-lg {
inline-size: auto;
}
.w-100-lg {
inline-size: 100%;
}
.w-100-min-lg {
min-inline-size: 100%;
}
.w-100-max-lg {
max-inline-size: 100%;
}
.w-100vw-lg {
inline-size: 100vw;
}
.w-vw-calc-lg {
inline-size: calc(100vw - var(--width));
}
.h-auto-lg {
block-size: auto;
}
.h-100-lg {
block-size: 100%;
}
.h-100-min-lg {
min-block-size: 100%;
}
.h-100-max-lg {
max-block-size: 100%;
}
.h-100vh-lg {
block-size: 100vh;
}
.h-vh-calc-lg {
block-size: calc(100vh - var(--height));
}
}
@mixin sizes-md-css {
.w-auto-md {
inline-size: auto;
}
.w-100-md {
inline-size: 100%;
}
.w-100-min-md {
min-inline-size: 100%;
}
.w-100-max-md {
max-inline-size: 100%;
}
.w-100vw-md {
inline-size: 100vw;
}
.w-vw-calc-md {
inline-size: calc(100vw - var(--width));
}
.h-auto-md {
block-size: auto;
}
.h-100-md {
block-size: 100%;
}
.h-100-min-md {
min-block-size: 100%;
}
.h-100-max-md {
max-block-size: 100%;
}
.h-100vh-md {
block-size: 100vh;
}
.h-vh-calc-md {
block-size: calc(100vh - var(--height));
}
}
@mixin sizes-sm-css {
.w-auto-sm {
inline-size: auto;
}
.w-100-sm {
inline-size: 100%;
}
.w-100-min-sm {
min-inline-size: 100%;
}
.w-100-max-sm {
max-inline-size: 100%;
}
.w-100vw-sm {
inline-size: 100vw;
}
.w-vw-calc-sm {
inline-size: calc(100vw - var(--width));
}
.h-auto-sm {
block-size: auto;
}
.h-100-sm {
block-size: 100%;
}
.h-100-min-sm {
min-block-size: 100%;
}
.h-100-max-sm {
max-block-size: 100%;
}
.h-100vh-sm {
block-size: 100vh;
}
.h-vh-calc-sm {
block-size: calc(100vh - var(--height));
}
}
@mixin sizes-xs-css {
.w-auto-xs {
inline-size: auto;
}
.w-100-xs {
inline-size: 100%;
}
.w-100-min-xs {
min-inline-size: 100%;
}
.w-100-max-xs {
max-inline-size: 100%;
}
.w-100vw-xs {
inline-size: 100vw;
}
.w-vw-calc-xs {
inline-size: calc(100vw - var(--width));
}
.h-auto-xs {
block-size: auto;
}
.h-100-xs {
block-size: 100%;
}
.h-100-min-xs {
min-block-size: 100%;
}
.h-100-max-xs {
max-block-size: 100%;
}
.h-100vh-xs {
block-size: 100vh;
}
.h-vh-calc-xs {
block-size: calc(100vh - var(--height));
}
}