This topic lists the supported USS properties and their accepted values.
USS data types define values and keywords accepted by USS properties.
#hexadecimal
code, rgb()
, or rgba()
. Color keywords such as blue
or transparent
are not supported.UIElements style properties use the same grammar syntax as W3C CSS documents:
auto
, baseline
.<
and >
). For example: <length>, <color>.<'
and '>
). For example, <‘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.When no value is specified for an inherited property, the element gets the value from its parent element. For example, use an inherited property to set the font for all elements.
:root {
-unity-font: resource("Font/consola.ttf");
}
The following properties are inherited:
The width
and height
specifies the size of the element. 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.
The margin
shorthand options are applied as follows:
margin-top
and margin-bottom
. The second is applied to margin-left
and margin-right
.margin-top
. The second is applied to margin-left
and margin-right
. The third is applied to margin-bottom
.margin-top
, margin-right
, margin-bottom
, margin-left
The border-width
shorthand options are applied as follows:
border-top-width
and border-bottom-width
. The second is applied to border-left-width
and border-right-width
.border-top-width
. The second is applied to border-left-width
and border-right-width
. The third is applied to border-bottom-width
.border-top-width
, border-right-width
, border-bottom-width
, border-left-width
The padding
shorthand options are applied as follows:
padding-top
and padding-bottom
. The second is applied to padding-left
and padding-right
.padding-top
. The second is applied to padding-left
and padding-right
. The third is applied to padding-bottom
.padding-top
, padding-right
, padding-bottom
, padding-left
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.
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 from the parent edge or the original position of the element.
The drawing properties set the background, borders, and appearance of the visual element.
When assigning a background image, it can be drawn with respect to a simplified 9-slice specification:
The border-radius
shorthand options are applied as follows:
border-top-left-radius
and border-bottom-right-radius
. The second is applied to border-bottom-left-radius
and border-top-right-radius
border-top-left-radius
. The second is applied to border-bottom-left-radius
and border-top-right-radius
. The third is applied to border-bottom-right-radius
.border-top-left-radius
, border-top-right-radius
, border-bottom-right-radius
, border-bottom-left-radius
The display
default value is flex
. Setting display
to none
removes the 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.
cursor: [ [ <resource> | <url> ][ <integer> <integer>]? , ][ 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 ]