Getting started
Resources
Flex
Spacing
Layout
Size
Typography
Background
Border
Transition
Utility classes for changing an element's padding property. Includes omni-directional, top, right, bottom, left, top/bottom, and right/left variants.
Unity does not support rem/em units, or allow calc() methods in USS files. All spacing classes use px values, and follow the default increment stated unless changed by you. Learn more about Customizing Utility Classes.
Classes for padding are named using the format: [p][direction(s)]-[value]
. Direction is optional, and if omitted, will be applied in all 4 directions.
Where direction includes:
nothing
- for padding
in all 4 directionst
- for padding-top
r
- for padding-right
b
- for padding-bottom
l
- for padding-left
x
- for padding-right
& padding-left
y
- for padding-top
& padding-bottom
Where value includes:
#
- px value for that padding property. By default, padding classes start at 0px, and increment by 4px until stopping at 64px.Class | Contents |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Most elements have a default padding of 0px
in all directions, but Unity applies a 4px
of top / bottom padding, 2px
of right padding, and 1px
of left padding for labels. For consistency, and easier debugging, it is advised to always apply the p-0
and m-0
classes for labels, then apply your desired spacing after.
UXML
UXML
UXML
UXML
On this page