Justify

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

Utilities (anchor)

Justify utility names and property values
Utility name Property values
Justify content
.justify-content-flex-start justify-content: flex-start
.justify-content-flex-end justify-content: flex-end
.justify-content-start justify-content: start
.justify-content-end justify-content: end
.justify-content-center justify-content: center
.justify-content-around justify-content: space-around
.justify-content-between justify-content: space-between
.justify-content-evenly justify-content: space-evenly
Justify items
.justify-items-flex-start justify-items: flex-start
.justify-items-flex-end justify-items: flex-end
.justify-items-start justify-items: start
.justify-items-end justify-items: end
.justify-items-center justify-items: center
Justify self
.justify-self-flex-start justify-self: flex-start
.justify-self-flex-end justify-self: flex-end
.justify-self-start justify-self: start
.justify-self-end justify-self: end
.justify-self-center justify-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:

.justify-content-start
.justify-content-start-xxl
.justify-content-start-xl
.justify-content-start-lg
.justify-content-start-md
.justify-content-start-sm
.justify-content-start-xs
.justify-content-start-xxs

The optional align and place utility styles can also be used with the justify 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 justify-content-css;
@include justify-items-css;
@include justify-self-css;

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

Or included grouped in a single mixin:

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

// Example breakpoint
@media (width <= 480px) {
  @include justify-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:

overrides.scss
@use "stylemods/scss/configuration" as *;
$enable-justify:      true;
$enable-justify-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 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.

justify.scss
//  ------------------------------------------------------------
//  Justify
//  ------------------------------------------------------------
$justify-content-values: (
  "flex-start": flex-start,
  "flex-end": flex-end,
  "start": start,
  "end": end,
  "center": center,
  "around": space-around,
  "between": space-between,
  "evenly": space-evenly,
) !default;

$justify-items-self-values: (
  "flex-start": flex-start,
  "flex-end": flex-end,
  "start": start,
  "end": end,
  "center": center,
) !default;

@mixin justify-content-css {  
  @each $name, $value in $justify-content-values {
    .justify-content-#{$name} {
      justify-content: #{$value};
    }
  }
}

@mixin justify-items-css {  
  @each $name, $value in $justify-items-self-values {
    .justify-items-#{$name} {
      justify-items: #{$value};
    }
  }
}

@mixin justify-self-css {  
  @each $name, $value in $justify-items-self-values {
    .justify-self-#{$name} {
      justify-self: #{$value};
    }
  }
}

// Breakpoint XXL
@mixin justify-content-xxl-css {  
  @each $name, $value in $justify-content-values {
    .justify-content-#{$name}-xxl {
      justify-content: #{$value};
    }
  }
}

@mixin justify-items-xxl-css {  
  @each $name, $value in $justify-items-self-values {
    .justify-items-#{$name}-xxl {
      justify-items: #{$value};
    }
  }
}

@mixin justify-self-xxl-css {  
  @each $name, $value in $justify-items-self-values {
    .justify-self-#{$name}-xxl {
      justify-self: #{$value};
    }
  }
}

// Breakpoint XL
@mixin justify-content-xl-css {  
  @each $name, $value in $justify-content-values {
    .justify-content-#{$name}-xl {
      justify-content: #{$value};
    }
  }
}

@mixin justify-items-xl-css {  
  @each $name, $value in $justify-items-self-values {
    .justify-items-#{$name}-xl {
      justify-items: #{$value};
    }
  }
}

@mixin justify-self-xl-css {  
  @each $name, $value in $justify-items-self-values {
    .justify-self-#{$name}-xl {
      justify-self: #{$value};
    }
  }
}

// Breakpoint LG
@mixin justify-content-lg-css {  
  @each $name, $value in $justify-content-values {
    .justify-content-#{$name}-lg {
      justify-content: #{$value};
    }
  }
}

@mixin justify-items-lg-css {  
  @each $name, $value in $justify-items-self-values {
    .justify-items-#{$name}-lg {
      justify-items: #{$value};
    }
  }
}

@mixin justify-self-lg-css {  
  @each $name, $value in $justify-items-self-values {
    .justify-self-#{$name}-lg {
      justify-self: #{$value};
    }
  }
}

// Breakpoint MD
@mixin justify-content-md-css {  
  @each $name, $value in $justify-content-values {
    .justify-content-#{$name}-md {
      justify-content: #{$value};
    }
  }
}

@mixin justify-items-md-css {  
  @each $name, $value in $justify-items-self-values {
    .justify-items-#{$name}-md {
      justify-items: #{$value};
    }
  }
}

@mixin justify-self-md-css {  
  @each $name, $value in $justify-items-self-values {
    .justify-self-#{$name}-md {
      justify-self: #{$value};
    }
  }
}

// Breakpoint SM
@mixin justify-content-sm-css {  
  @each $name, $value in $justify-content-values {
    .justify-content-#{$name}-sm {
      justify-content: #{$value};
    }
  }
}

@mixin justify-items-sm-css {  
  @each $name, $value in $justify-items-self-values {
    .justify-items-#{$name}-sm {
      justify-items: #{$value};
    }
  }
}

@mixin justify-self-sm-css {  
  @each $name, $value in $justify-items-self-values {
    .justify-self-#{$name}-sm {
      justify-self: #{$value};
    }
  }
}

// Breakpoint XS
@mixin justify-content-xs-css {  
  @each $name, $value in $justify-content-values {
    .justify-content-#{$name}-xs {
      justify-content: #{$value};
    }
  }
}

@mixin justify-items-xs-css {  
  @each $name, $value in $justify-items-self-values {
    .justify-items-#{$name}-xs {
      justify-items: #{$value};
    }
  }
}

@mixin justify-self-xs-css {  
  @each $name, $value in $justify-items-self-values {
    .justify-self-#{$name}-xs {
      justify-self: #{$value};
    }
  }
}

// Breakpoint XXS
@mixin justify-content-xxs-css {  
  @each $name, $value in $justify-content-values {
    .justify-content-#{$name}-xxs {
      justify-content: #{$value};
    }
  }
}

@mixin justify-items-xxs-css {  
  @each $name, $value in $justify-items-self-values {
    .justify-items-#{$name}-xxs {
      justify-items: #{$value};
    }
  }
}

@mixin justify-self-xxs-css {  
  @each $name, $value in $justify-items-self-values {
    .justify-self-#{$name}-xxs {
      justify-self: #{$value};
    }
  }
}

// Grouped mixins
@mixin justify-css {
  @include justify-content-css;
  @include justify-items-css;
  @include justify-self-css;
}

@mixin justify-xxl-css {
  @include justify-content-xxl-css;
  @include justify-items-xxl-css;
  @include justify-self-xxl-css;
}

@mixin justify-xl-css {
  @include justify-content-xl-css;
  @include justify-items-xl-css;
  @include justify-self-xl-css;
}

@mixin justify-lg-css {
  @include justify-content-lg-css;
  @include justify-items-lg-css;
  @include justify-self-lg-css;
}

@mixin justify-md-css {
  @include justify-content-md-css;
  @include justify-items-md-css;
  @include justify-self-md-css;
}

@mixin justify-sm-css {
  @include justify-content-sm-css;
  @include justify-items-sm-css;
  @include justify-self-sm-css;
}

@mixin justify-xs-css {
  @include justify-content-xs-css;
  @include justify-items-xs-css;
  @include justify-self-xs-css;
}

@mixin justify-xxs-css {
  @include justify-content-xxs-css;
  @include justify-items-xxs-css;
  @include justify-self-xxs-css;
}