static mixin
Sets position to static, the default document flow.
@mixin staticExample
.element { @include static;}Compiled CSS
.element { position: static;}Controls element positioning and placement within the document flow.
<!-- Basic positioning --><div class="relative"> <div class="absolute top-0 right-0"> Positioned in top-right corner </div></div><!-- Sticky header --><header class="sticky top-0"> This header sticks to the top when scrolling</header><!-- Responsive positioning --><div class="relative@md"> <div class="absolute@md top-2 left-2"> Only positioned on medium screens and up </div></div>Position types:
Inset:
Placement:
Common values: spacing keys 0, 1, 2, 3, 4, 5, 6, 8, etc. (var(--wu-space-*)) and fractions 25p, 33p, 50p, 66p, 75p, 100p (percentages)
Responsive: all position classes support responsive variants using the @breakpoint suffix:
See also z-index and transform.
Generated from the doc blocks in the core source when the site is built, so it always matches the current release of @wovenui/core. Every example is compiled against core during the build; open Compiled CSSunder an example to see its output. Guide: Position. The A to Z index lists every public mixin and function.
static relative absolute fixed sticky top right bottom left inset-start inset-end inset inset-x inset-y inset-auto inset-x-auto inset-y-auto absolute-center
static mixinSets position to static, the default document flow.
@mixin staticExample
.element { @include static;}.element { position: static;}relative mixinSets position to relative, creating a positioning context for absolute children.
@mixin relativeExample
.container { @include relative;}.container { position: relative;}absolute mixinSets position to absolute, removing the element from the normal document flow.
@mixin absoluteExample
.popup { @include absolute; @include top(0); @include left(0);}.popup { position: absolute; top: var(--wu-space-0); left: var(--wu-space-0);}fixed mixinSets position to fixed, placing the element relative to the viewport.
@mixin fixedExample
.banner { @include fixed; @include top(0); @include inset-x(0);}.banner { position: fixed; top: var(--wu-space-0); left: var(--wu-space-0); right: var(--wu-space-0);}sticky mixinSets position to sticky with top 0 and z-index 999, so the element stays in view while scrolling.
@mixin stickyposition: sticky; z-index: 999; top: 0Example
.nav { @include sticky;}.nav { position: sticky; z-index: 999; top: 0;}top mixinSets the physical top offset from the spacing scale or a raw value.
@mixin top($value)| Parameter | Type | Default | Description |
|---|---|---|---|
$value | Number|Length|String | Required | Spacing key (4), negative key (-4), fraction key (25p, -25p; 33p gives 33.333%), auto, or a raw length, percentage, calc() or var() |
Example
.toast { @include absolute; @include top(4); // top: var(--wu-space-4)}.toast { position: absolute; top: var(--wu-space-4);}right mixinSets the physical right offset from the spacing scale or a raw value.
@mixin right($value)| Parameter | Type | Default | Description |
|---|---|---|---|
$value | Number|Length|String | Required | Spacing key (4), negative key (-4), fraction key (25p, -25p; 33p gives 33.333%), auto, or a raw length, percentage, calc() or var() |
Example
.badge { @include absolute; @include right(-2); // right: calc(-1 * var(--wu-space-2))}.badge { position: absolute; right: calc(-1 * var(--wu-space-2));}bottom mixinSets the physical bottom offset from the spacing scale or a raw value.
@mixin bottom($value)| Parameter | Type | Default | Description |
|---|---|---|---|
$value | Number|Length|String | Required | Spacing key (4), negative key (-4), fraction key (25p, -25p; 33p gives 33.333%), auto, or a raw length, percentage, calc() or var() |
Example
.footer { @include fixed; @include bottom(0);}.footer { position: fixed; bottom: var(--wu-space-0);}left mixinSets the physical left offset from the spacing scale or a raw value.
@mixin left($value)| Parameter | Type | Default | Description |
|---|---|---|---|
$value | Number|Length|String | Required | Spacing key (4), negative key (-4), fraction key (25p, -25p; 33p gives 33.333%), auto, or a raw length, percentage, calc() or var() |
Example
.sidebar { @include fixed; @include left(50%);}.sidebar { position: fixed; left: 50%;}inset-start mixinSets inset-inline-start, which is the left offset in LTR and the right offset in RTL.
@mixin inset-start($value)| Parameter | Type | Default | Description |
|---|---|---|---|
$value | Number|Length|String | Required | Spacing key (4), negative key (-4), fraction key (25p, -25p; 33p gives 33.333%), auto, or a raw length, percentage, calc() or var() |
Example
.close-button { @include absolute; @include inset-start(2); // inset-inline-start: var(--wu-space-2)}.close-button { position: absolute; inset-inline-start: var(--wu-space-2);}inset-end mixinSets inset-inline-end, which is the right offset in LTR and the left offset in RTL.
@mixin inset-end($value)| Parameter | Type | Default | Description |
|---|---|---|---|
$value | Number|Length|String | Required | Spacing key (4), negative key (-4), fraction key (25p, -25p; 33p gives 33.333%), auto, or a raw length, percentage, calc() or var() |
Example
.close-button { @include absolute; @include top(2); @include inset-end(2); // inset-inline-end: var(--wu-space-2)}.close-button { position: absolute; top: var(--wu-space-2); inset-inline-end: var(--wu-space-2);}inset mixinSets the inset shorthand (top, right, bottom and left) to one value.
@mixin inset($val)| Parameter | Type | Default | Description |
|---|---|---|---|
$val | Number|Length|String | Required | Spacing key (4), negative key (-4), fraction key (25p, -25p; 33p gives 33.333%), auto, or a raw length, percentage, calc() or var() |
Example
.overlay { @include absolute; @include inset(0); // inset: var(--wu-space-0)}.overlay { position: absolute; inset: var(--wu-space-0);}inset-x mixinSets the physical left and right offsets to one value.
@mixin inset-x($val)| Parameter | Type | Default | Description |
|---|---|---|---|
$val | Number|Length|String | Required | Spacing key (4), negative key (-4), fraction key (25p, -25p; 33p gives 33.333%), auto, or a raw length, percentage, calc() or var() |
Example
.drawer-footer { @include absolute; @include bottom(0); @include inset-x(4);}.drawer-footer { position: absolute; bottom: var(--wu-space-0); left: var(--wu-space-4); right: var(--wu-space-4);}inset-y mixinSets the top and bottom offsets to one value.
@mixin inset-y($val)| Parameter | Type | Default | Description |
|---|---|---|---|
$val | Number|Length|String | Required | Spacing key (4), negative key (-4), fraction key (25p, -25p; 33p gives 33.333%), auto, or a raw length, percentage, calc() or var() |
Example
.side-rail { @include absolute; @include inset-y(0); @include left(0);}.side-rail { position: absolute; top: var(--wu-space-0); bottom: var(--wu-space-0); left: var(--wu-space-0);}inset-auto mixinSets the inset shorthand to auto on all four sides.
@mixin inset-autoExample
.popover { @include inset-auto;}.popover { inset: auto;}inset-x-auto mixinSets the physical left and right offsets to auto.
@mixin inset-x-autoExample
.tooltip { @include inset-x-auto;}.tooltip { left: auto; right: auto;}inset-y-auto mixinSets the top and bottom offsets to auto.
@mixin inset-y-autoExample
.tooltip { @include inset-y-auto;}.tooltip { top: auto; bottom: auto;}absolute-center mixinCenters an element absolutely within its positioned parent using top and left 50% and a -50% translate.
@mixin absolute-centerExample
.modal { @include absolute-center;}.modal { position: absolute; left: 50%; top: 50%; transform: translateX(var(--wu-translate-x)) translateY(var(--wu-translate-y)) translateZ(var(--wu-translate-z)) rotate(var(--wu-rotate)) skewX(var(--wu-skew-x)) skewY(var(--wu-skew-y)) scaleX(var(--wu-scale-x)) scaleY(var(--wu-scale-y)); --wu-translate-x: -50%; --wu-translate-y: -50%;}