Utility classes for changing an element's text align property. Text align affects the text's vertical, and horizontal alignment within it's container.

Classes for text alignment are named using the format: [text]-[vertical]-[horizontal].

Where vertical includes:

  • upper - for -unity-text-align: upper-[horizontal]
  • middle - for -unity-text-align: middle-[horizontal]
  • lower - for -unity-text-align: lower-[horizontal]

Where horizontal includes:

  • left - for -unity-text-align: [vertical]-left
  • center - for -unity-text-align: [vertical]-center
  • right - for -unity-text-align: [vertical]-right
ClassContents

Note that -unity-text-align: upper-left is the default value for text align in Unity. Unless the value needs to be overridden from a parent, the text-upper-leftclass is not needed.

upper-center
middle-center
lower-center

UXML

middle-left
middle-center
middle-right

UXML

By default, labels in Unity will grow to 100% width, but not height. Vertical alignment will not work if the label is not occupying enough vertical space.

middle-center
middle-center

UXML