Skip to content

Align

Align utilities for grid and flex display with module mixins for responsive modifiers.

Utilities (anchor)

Align utility names and property values
Utility name Property values
Align content
.align-content-flex-start align-content: flex-start
.align-content-flex-end align-content: flex-end
.align-content-start align-content: start
.align-content-end align-content: end
.align-content-center align-content: center
.align-content-around align-content: space-around
.align-content-between align-content: space-between
.align-content-evenly align-content: space-evenly
Align items
.align-items-flex-start align-items: flex-start
.align-items-flex-end align-items: flex-end
.align-items-start align-items: start
.align-items-end align-items: end
.align-items-center align-items: center
Align self
.align-self-flex-start align-self: flex-start
.align-self-flex-end align-self: flex-end
.align-self-start align-self: start
.align-self-end align-self: end
.align-self-center align-self: center

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:

.align-items-start
.align-items-start-xxl
.align-items-start-xl
.align-items-start-lg
.align-items-start-md
.align-items-start-sm
.align-items-start-xs
.align-items-start-xxs

The optional justify and place utility styles can also be used with the align utilities if included.

Using the module (anchor)

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

Each set of utilities can be included individually:

custom.scss
@use "stylemods/scss" as *;
@include align-content-css;
@include align-items-css;
@include align-self-css;

// Example breakpoint
@media (width < 480px) {
  @include align-content-sm-css;
  @include align-items-sm-css;
  @include align-self-sm-css;
}

Or included grouped in a single mixin:

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

// Example breakpoint
@media (width < 480px) {
  @include alignment-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-align:      true;
$enable-align-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 Align 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/align.scss
View on Github
https://github.com/pmbrown/StyleMods/blob/main/scss/layout/align.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.