pos

Shorthand for use position properties.

Arguments

NameTypeDefaultDescription
$positionstringabsolutePosition type (relative, absolute, etc.).
$valueslist()Position values list in default order (top-right-bottom-left)*.
$z-indexnumbernullz-index property value if needed
Some values can be omitted using null (preferable) or its alias n .

Example

@use 'more-sass' as more;

.element-one {
    @include more.pos('absolute', 10px);
}

.element-two {
    @include more.pos('absolute', 10px 20px 30px 40px, 5);
}

.element-three {
    @include more.pos('absolute', null auto);
}
.element-one {
    position: absolute;
    top: 10px;
    right: 10px;
    bottom: 10px;
    left: 10px;
}

.element-two {
    position: absolute;
    top: 10px;
    right: 20px;
    bottom: 30px;
    left: 40px;
  z-index: 5;
}

.element-three {
    position: absolute;
    right: auto;
    left: auto;
}

There are also available shorthands for certain position types:

pos-rel($values, $z-index) pos-abs($values, $z-index) pos-fix($values, $z-index)

Edit this page on GitHub Updated at Mon, Jan 30, 2023