Spacing
Utilities for controlling an element's padding.
Class | Styles |
---|---|
p-<number> | padding: calc(var(--spacing) * <number>); |
px-<number> | padding-inline: calc(var(--spacing) * <number>); |
py-<number> | padding-block: calc(var(--spacing) * <number>); |
ps-<number> | padding-inline-start: calc(var(--spacing) * <number>) |
pe-<number> | padding-inline-end: calc(var(--spacing) * <number>) |
pt-<number> | padding-top: calc(var(--spacing) * <number>) |
pr-<number> | padding-right: calc(var(--spacing) * <number>) |
pb-<number> | padding-bottom: calc(var(--spacing) * <number>) |
pl-<number> | padding-left: calc(var(--spacing) * <number>) |
p-(<custom-property>) | padding: var(<custom-property>); |
p-[<value>] | padding: <value>; |
Use the pt-*
, pr-*
, pb-*
, and pl-*
utilities to control the padding on one side of an element.
For example, pt-6
would add 1.5rem
of padding to the top of an element, pr-4
would add 1rem
of padding to the right of an element, pb-8
would add 2rem
of padding to the bottom of an element, and pl-2
would add 0.5rem
of padding to the left of an element.
Use the px-*
utilities to control the horizontal padding of an element:
Use the py-*
utilities to control the vertical padding of an element:
Use the p-*
utilities to control the padding on all sides of an element:
Use the ps-*
and pe-*
utilities to set the padding-inline-start
and padding-inline-end
logical properties:
Use the padding-(<custom-property>)
syntax to set the padding based on a custom property:
<div class="padding-(--my-padding) ..."> <!-- ... --></div>
Use the padding-[<value>]
syntax to set the padding based on a completely custom value:
<div class="padding-[5px] ..."> <!-- ... --></div>
Prefix a padding
utility with a breakpoint variant like md:
to only apply the utility at medium screen sizes and above:
<div class="py-4 md:py-8"> <!-- ... --></div>
Learn more about using variants in the variants documentation.
Use the --padding-*
theme variables to customize the padding utilities in your project:
@theme { --padding-5px: 5px; }
Now the padding-5px
utility can be used in your markup:
<div class="padding-5px"> <!-- ... --></div>
Learn more about customizing your theme in the theme documentation.