Version: 2021.1
LanguageEnglish
  • C#

IStyle

interface in UnityEngine.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 inline style data.

Reading properties from this object will read from the inline style data for this element. To read the style data computed for the element use IComputedStyle interface. 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.
borderBottomColorColor of the element's bottom border.
borderBottomLeftRadiusThe radius of the bottom-left corner when a rounded rectangle is drawn in the element's box.
borderBottomRightRadiusThe 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.
borderLeftColorColor of the element's left border.
borderLeftWidthSpace reserved for the left edge of the border during the layout phase.
borderRightColorColor of the element's right border.
borderRightWidthSpace reserved for the right edge of the border during the layout phase.
borderTopColorColor of the element's top border.
borderTopLeftRadiusThe radius of the top-left corner when a rounded rectangle is drawn in the element's box.
borderTopRightRadiusThe 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.
bottomBottom distance from the element's box during layout.
colorColor to use when drawing the text of an element.
cursorMouse cursor to display when the mouse pointer is over an element.
displayDefines how an element is displayed in the layout.
flexBasisInitial main size of a flex item, on the main flex axis. The final layout mught be smaller or larger, according to the flex shrinking and growing determined by the flex property.
flexDirectionDirection of the main axis to layout children in a container.
flexGrowSpecifies how much the item will grow relative to the rest of the flexible items inside the same container.
flexShrinkSpecifies how the item will shrink relative to the rest of the flexible items inside the same container.
flexWrapPlacement of children over multiple lines if not enough space is available in this container.
fontSizeFont size to draw the element's text.
heightFixed height of an element for the layout.
justifyContentJustification of children on the main axis of this container.
leftLeft distance from the element's box during layout.
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 width for an element, when it is flexible or measures its own size.
opacitySpecifies the transparency of an element.
overflowHow a container behaves if its content overflows its own box.
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.
positionElement's positioning in its parent container.
rightRight distance from the element's box during layout.
textOverflowThe element's text overflow mode.
topTop distance from the element's box during layout.
unityBackgroundImageTintColorTinting color for the element's backgroundImage
unityBackgroundScaleModeBackground image scaling in the element's box.
unityFontFont to draw the element's text.
unityFontStyleAndWeightSize of the 9-slice's bottom edge when painting an element's background image.
unityOverflowClipBoxSpecifies which box the element content is clipped against.
unitySliceBottomSize of the 9-slice's bottom edge when painting an element's background image.
unitySliceLeftSize of the 9-slice's left edge when painting an element's background image.
unitySliceRightSize of the 9-slice's right edge when painting an element's background image.
unitySliceTopSize of the 9-slice's top edge when painting an element's background image.
unityTextAlignHorizontal and vertical text alignment in the element's box.
unityTextOverflowPositionThe element's text overflow position.
visibilitySpecifies whether or not an element is visible.
whiteSpaceWord wrapping over multiple lines if not enough space is available to draw the text of an element.
widthFixed width of an element for the layout.