Skip to content

Sizes

A basic set of height and width size utilities with module mixins for responsive modifiers.

Utilities (anchor)

Height utility names and property values
Utility name Property values
.h-auto block-size: auto
.h-fit-content block-size: fit-content
.h-min-content block-size: min-content
.h-max-content block-size: max-content
.h-100 block-size: 100%
.h-100vh block-size: 100vh
.h-100dvh block-size: 100dvh
.h-vh-calc block-size: calc(100vh - var(--vh))
.h-dvh-calc block-size: calc(100dvh - var(--dvh))
.h-initial block-size: initial
Min and max height utilities
Min-height utility names and property values
Utility name Property values
.h-auto-min min-block-size: auto
.h-fit-content-min min-block-size: fit-content
.h-min-content-min min-block-size: min-content
.h-max-content-min min-block-size: max-content
.h-100-min min-block-size: 100%
.h-100vh-min min-block-size: 100vh
.h-100dvh-min min-block-size: 100dvh
.h-vh-calc-min min-block-size: calc(100vh - var(--vh))
.h-dvh-calc-min min-block-size: calc(100dvh - var(--dvh))
.h-initial-min min-block-size: initial
Max-height utility names and property values
Utility name Property values
.h-auto-max max-block-size: auto
.h-fit-content-max max-block-size: fit-content
.h-min-content-max max-block-size: min-content
.h-max-content-max max-block-size: max-content
.h-100-max max-block-size: 100%
.h-100vh-max max-block-size: 100vh
.h-100dvh-max max-block-size: 100dvh
.h-vh-calc-max max-block-size: calc(100vh - var(--vh))
.h-dvh-calc-max max-block-size: calc(100dvh - var(--dvh))
.h-initial-max max-block-size: initial
Width utility names and property values
Utility name Property values
.w-auto inline-size: auto
.w-fit-content inline-size: fit-content
.w-min-content inline-size: min-content
.w-max-content inline-size: max-content
.w-100 inline-size: 100%
.w-100vw inline-size: 100vh
.w-100dvw inline-size: 100dvh
.w-vw-calc inline-size: calc(100vw - var(--vw))
.w-dvw-calc inline-size: calc(100dvw - var(--dvw))
.w-initial inline-size: initial
Min and max width utilities
Min-height utility names and property values
Utility name Property values
.w-auto-min min-inline-size: auto
.w-fit-content-min min-inline-size: fit-content
.w-min-content-min min-inline-size: min-content
.w-max-content-min min-inline-size: max-content
.w-100-min min-inline-size: 100%
.w-100vw-min min-inline-size: 100vw
.w-100dvw-min min-inline-size: 100dvw
.w-vw-calc-min min-inline-size: calc(100vw - var(--vw))
.w-dvw-calc-min min-inline-size: calc(100dvw - var(--dvw))
.w-initial-min min-inline-size: initial
Max-height utility names and property values
Utility name Property values
.w-auto-max max-inline-size: auto
.w-fit-content-max max-inline-size: fit-content
.w-min-content-max max-inline-size: min-content
.w-max-content-max max-inline-size: max-content
.w-100-max max-inline-size: 100%
.w-100vw-max max-inline-size: 100vw
.w-100dvw-max max-inline-size: 100dvw
.w-vw-calc-max max-inline-size: calc(100vw - var(--vw))
.w-dvw-calc-max max-inline-size: calc(100dvw - var(--dvw))
.w-initial-max max-inline-size: 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:

.h-auto
.h-auto-xxl
.h-auto-xl
.h-auto-lg
.h-auto-md
.h-auto-sm
.h-auto-xs
.h-auto-xxs

Using the module (anchor)

Load StyleMods as demonstrated (change file path as required) then include the Sass mixin anywhere below.

Include height (block) and width (inline) sizes individually:

custom.scss
@use "stylemods/scss" as *;
@include block-size-css;
@include inline-size-css;

// Example breakpoint
@media (width < 480px) {
  @include block-size-sm-css;
  @include inline-size-sm-css;
}

Include both sizes in a single mixin:

custom.scss
@use "stylemods/scss" as *;
@include sizes-css;

// Example breakpoint
@media (width < 480px) {
  @include sizes-sm-css;
}

See the using modules page for more information.

Using the framework (anchor)

Using the recommended custom setup enable the styles (and required breakpoints) in an overrides document:

overrides.scss
@use "stylemods/scss/configuration" as *;
$enable-sizes:      true;
$enable-sizes-sm:   true;

Include the overrides and the framework styles with your custom document for compiling the framework:

custom.scss
@use "overrides";
@use "stylemods/scss/stylemods";

See using the framework for more information.

Source code (anchor)

The Sizes source file is included with the layout module files, you can view the source code from the latest release (v1.5.0) via the Github link below.

Source document
stylemods/scss/layout/sizes.scss
View on Github
https://github.com/pmbrown/StyleMods/blob/main/scss/layout/sizes.scss

Shared documentation about how to customize the default property values for the styles using the Sass and CSS variables is provided on the customizing page.