Version: 2017.3 (switch to 2017.4)
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

Experimental: this API is experimental and might be changed or removed in the future.

IStyle

interface in UnityEngine.Experimental.UIElements

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

This interface provides access to a VisualElement style data.

Reading properties from this object will read from the shared copy of style data, if multiple elements match the same USS rules. When writing to any of the properties the target element will start owning its own style data and stop using the shared copy. Writing to a property will mask the value coming from USS with the provided value however other properties will still match the values from USS.

Properties

alignContentAlignment of the whole area of children on the cross axis if they span over multiple lines in this container.
alignItemsAlignment of children on the cross axis of this container.
alignSelfSimilar to align-items, but only for this specific element.
backgroundColorBackground color to paint in the element's box.
backgroundImageBackground image to paint in the element's box.
backgroundSizeBackground image scaling in the element's box.
borderBottomSpace reserved for the bottom edge of the border during the layout phase.
borderBottomLeftRadiusThis is the radius of the bottom-left corner when a rounded rectangle is drawn in the element's box.
borderBottomRightRadiusThis is the radius of the bottom-right corner when a rounded rectangle is drawn in the element's box.
borderBottomWidthSpace reserved for the bottom edge of the border during the layout phase.
borderColorColor of the border to paint inside the element's box.
borderLeftSpace reserved for the left edge of the border during the layout phase.
borderLeftWidthSpace reserved for the left edge of the border during the layout phase.
borderRadiusThis is the radius of every corner when a rounded rectangle is drawn in the element's box.
borderRightSpace reserved for the right edge of the border during the layout phase.
borderRightWidthSpace reserved for the right edge of the border during the layout phase.
borderTopSpace reserved for the top edge of the border during the layout phase.
borderTopLeftRadiusThis is the radius of the top-left corner when a rounded rectangle is drawn in the element's box.
borderTopRightRadiusThis is the radius of the top-right corner when a rounded rectangle is drawn in the element's box.
borderTopWidthSpace reserved for the top edge of the border during the layout phase.
flexRation of this element in its parent during the layout phase.
flexDirectionDirection of the main axis to layout children in a container.
flexWrapPlacement of children over multiple lines if not enough space is available in this container.
fontFont to draw the element's text.
fontSizeFont size to draw the element's text.
fontStyleFont style to draw the element's text.
heightFixed height of an element for the layout.
justifyContentJustification of children on the main axis of this container.
marginBottomSpace reserved for the bottom edge of the margin during the layout phase.
marginLeftSpace reserved for the left edge of the margin during the layout phase.
marginRightSpace reserved for the right edge of the margin during the layout phase.
marginTopSpace reserved for the top edge of the margin during the layout phase.
maxHeightMaximum height for an element, when it is flexible or measures its own size.
maxWidthMaximum width for an element, when it is flexible or measures its own size.
minHeightMinimum height for an element, when it is flexible or measures its own size.
minWidthMinimum height for an element, when it is flexible or measures its own size.
paddingBottomSpace reserved for the bottom edge of the padding during the layout phase.
paddingLeftSpace reserved for the left edge of the padding during the layout phase.
paddingRightSpace reserved for the right edge of the padding during the layout phase.
paddingTopSpace reserved for the top edge of the padding during the layout phase.
positionBottomBottom distance from the element's box during layout.
positionLeftLeft distance from the element's box during layout.
positionRightRight distance from the element's box during layout.
positionTopTop distance from the element's box during layout.
positionTypeElement's positioning in its parent container.
sliceBottomSize of the 9-slice's bottom edge when painting an element's background image.
sliceLeftSize of the 9-slice's left edge when painting an element's background image.
sliceRightSize of the 9-slice's right edge when painting an element's background image.
sliceTopSize of the 9-slice's top edge when painting an element's background image.
textAlignmentText alignment in the element's box.
textClippingClipping if the text does not fit in the element's box.
textColorColor to use when drawing the text of an element.
widthFixed width of an element for the layout.
wordWrapWord wrapping over multiple lines if not enough space is available to draw the text of an element.

Did you find this page useful? Please give it a rating: