Utility classes for changing an element's position property. Position affects how the element behaves within the parent container, and in relation to sibling elements in the UXML layout.

Classes for position are named using the format: [value].

Where value includes:

  • relative - for position: relative
  • absolute - for position: absolute
ClassContents

Note that position: relative is the default value for position in Unity. Unless the value needs to be overridden from a parent, the relativeclass is not needed.

Relative elements will respect spacing values (margin, and padding) of sibling/parent elements, and position itself relative to other sibling elements according to the parent's flex direction, justification, and alignment.

Parent

Relative child
Relative child

UXML

Absolute elements will respect spacing values (margin, and padding) of parent elements only (unless the position is altered), and position itself only according to the parent relative container.

Parent

Relative child
Absolute child

UXML