Position

Basic position utility classes with module mixins for responsive modifiers.

Utilities (anchor)

Position utility names and property values
Utility name Property values
.absolute position: absolute
.fixed position: fixed
.relative position: relative
.static position: static
.sticky position: sticky
.position-unset position: unset

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:

.sticky
.sticky-xxl
.sticky-xl
.sticky-lg
.sticky-md
.sticky-sm
.sticky-xs
.sticky-xxs

Using the module (anchor)

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

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

// Example breakpoint
@media (width <= 480px) {
  @include position-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-position:      true;
$enable-position-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.

position.scss
//  ------------------------------------------------------------
//  Position
//  ------------------------------------------------------------
$position-values: (
  "absolute": absolute,
  "fixed": fixed,
  "relative": relative,
  "static": static,
  "sticky": sticky,
  "position-unset": unset,
) !default;

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

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

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

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

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

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

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

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