Position
Basic position utility classes with module mixins for responsive modifiers.
Examples
.pos-unset {
position: unset;
}
.pos-relative {
position: relative;
}
.pos-absolute {
position: absolute;
}
.pos-fixed {
position: fixed;
}
.pos-sticky {
position: sticky;
}
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 .pos-relative
utility.
.pos-relative
.pos-relative-xl
.pos-relative-lg
.pos-relative-md
.pos-relative-sm
.pos-relative-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 position-css;
// Example breakpoint
@media (max-width: 480px) {
@include position-sm-css;
}
Source
_position.scss
// ------------------------------------------------------------
// Position
// ------------------------------------------------------------
$unset: unset;
$relative: relative;
$absolute: absolute;
$fixed: fixed;
$sticky: sticky;
$position: (
"pos-unset": $unset,
"pos-relative": $relative,
"pos-absolute": $absolute,
"pos-fixed": $fixed,
"pos-sticky": $sticky,
) !default;
@mixin position-css {
@each $name, $value in $position {
.#{$name} {
position: #{$value};
}
}
}
@mixin position-xl-css {
@each $name, $value in $position {
.#{$name}-xl {
position: #{$value};
}
}
}
@mixin position-lg-css {
@each $name, $value in $position {
.#{$name}-lg {
position: #{$value};
}
}
}
@mixin position-md-css {
@each $name, $value in $position {
.#{$name}-md {
position: #{$value};
}
}
}
@mixin position-sm-css {
@each $name, $value in $position {
.#{$name}-sm {
position: #{$value};
}
}
}
@mixin position-xs-css {
@each $name, $value in $position {
.#{$name}-xs {
position: #{$value};
}
}
}