This topic lists the supported USS properties and their accepted values.
UIElements style properties use the same grammar syntax as W3C CSS documents:
auto
, baseline
.<
and >
). For example: <length>, <color>.<
and >
). For example, <border-width>.If a property value has more than one component:
|
) separates two or more alternatives: exactly one must occur.||
) separates two or more options: one or more must occur, in any order.&&
) separates two or more components, all of which must occur, in any order.[
]
) denote grouping.Every type, keyword, or angle-bracketed group may be followed by modifiers:
*
) indicates that the preceding type, word, or group occurs zero or more times.+
) indicates that the preceding type, word, or group occurs one or more times.?
) indicates that the preceding type, word, or group is optional.{A,B}
) indicates that the preceding type, word, or group occurs at least A
and at most B
times.The width
and height
specifies the size of the element in pixelsThe smallest unit in a computer image. Pixel size depends on your screen resolution. Pixel lighting is calculated at every screen pixel. More info
See in Glossary. If width
is not specified, the width is based on the width of the element’s contents. If height
is not specified, the height is based on the height of the element’s contents.
This section lists the properties for positioning visual elements. UIElements includes a layout engine that positions visual elements based on layout and styling properties. The layout engine implements a subset of Flexbox: a HTML/CSS layout system.
By default, all items are vertically placed in their container.
Note: Because units
are not supported, the <flex-basis> value must always be specified last.
This property is set to relative
by default, which positions the element based on its parent. If this property is set to absolute
, the element leaves its parent layout and values are specified based on the parent bounds.
The distance in pixels from the parent edge or the original position of the element.
The drawing properties set the background, borders, and appearance of the visual element.
Text properties set the color, font, font size, and Unity specific properties for font resource, font style, alignment, word wrap, and clipping.
Use the cursor
default texture type to import a custom texture for the cursor. The Unity editor only supports default cursor values.
cursor: [ [ <resource> | <url> ][ <hotspotX> <hotspotY>]? , ][ arrow | text | resize-vertical | resize-horizontal | link | slide-arrow | resize-up-right | resize-up-left | move-arrow | rotate-arrow | scale-arrow | arrow-plus | arrow-minus | pan | orbit | zoom | fps | split-resize-up-down | split-resize-left-right ]
This section lists the drawing properties that were either made obsolete or renamed in UIElements. The obsolete and renamed properties are listed alphabetically.
background-size
has been renamed -unity-background-scale-mode
.border-left
, border-top
, border-right
, and border-bottom
have been renamed border-left-width
, border-top-width
, border-right-width
, and border-bottom-width
, respectively.font
has been renamed -unity-font
.font-style
has been renamed -unity-font-style
.position-left
, position-top
, position-right
, and position-bottom
have been renamed left
, top
, right
, and bottom
, respectively.position-type
has been renamed position
.text-alignment
has been renamed -unity-text-align
.text-clipping
has been renamed -unity-clipping
. It is recommended that you use the standard overflow
property instead.text-color
has been renamed color
.-word-wrap
has been renamed -unity-word-wrap
.