Gerillass 2.0.0 is out. It renames every utility function and replaces two mixins with one, so read the migration guide before you upgrade.
Gerillass
v2.1.0* You can call mixins with or without the gls- namespace (e.g. @include gls-position();).
The Position Sass mixin provides a one-line method to quickly set both the position and the offset properties of a selected element.
Arguments
| Name | Type | Description |
|---|---|---|
$position | string | Sets the position property of the selected elements. Accepts the CSS values static, relative, fixed, absolute, and sticky. The default value is absolute. |
$offsets | list | Accepts a list of values to set the offsets of the box edges. It uses the CSS shorthand method. The default value is 0. |
To learn more about CSS shorthand properties, check out the links at the end of this page.
Examples
Call the mixin without passing any arguments to see the default values that it generates.
.element{
@include position;
}.element {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
}Now let's set the position value to fixed and leave the offset values as they are.
.element{
@include position(fixed);
}.element {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
}Changing the offset values is easy. Note that multiple offset values must be separated by a space.
.element{
@include position(fixed, 10px 10px 10px 50px);
}.element {
position: fixed;
top: 10px;
right: 10px;
bottom: 10px;
left: 50px;
}You can use the null value to skip positioning particular edges of an element.
.element{
@include position(absolute, null 16px 16px 16px);
}.element {
position: absolute;
right: 16px;
bottom: 16px;
left: 16px;
}