mt-6
mr-4
mb-8
ml-2
[Try it Β»](#)
In this example, `mt-6` sets the top margin, `mr-4` sets the right margin, `mb-8` sets the bottom margin, and `ml-2` sets the left margin.
Use the mx-* utility to control an element's horizontal margin.
mx-8
Use the my-* utility to control an element's vertical margin.
my-8
Use the m-* utility to control an element's margin on all sides.
m-8
* * *
## Padding
Padding is used to control the distance between an element's content and its border.
Like margin, Tailwind also provides a rich set of utility classes for padding.
* `p-{size}`: Sets the padding for all four sides.
* `pt-{size}`: Sets the top padding (padding-top).
* `pr-{size}`: Sets the right padding (padding-right).
* `pb-{size}`: Sets the bottom padding (padding-bottom).
* `pl-{size}`: Sets the left padding (padding-left).
* `px-{size}`: Sets the horizontal padding (left and right padding).
* `py-{size}`: Sets the vertical padding (top and bottom padding).
Common padding values:
* `p-0`: Sets the padding to 0.
* `p-1` to `p-64`: Sets padding of different sizes.
* `p-px`: Sets the padding to 1px.
## Example
pt-6
pr-4
pb-8
pl-2
[Try it Β»](#)
Use the px-* utility to control an element's horizontal padding.
px-8
Use the py-* utility to control an element's vertical padding.
py-8
Use the p-* utility to control an element's padding on all sides.
p-8
Use the ps-* and pe-* utilities to set the padding-inline-start and padding-inline-end logical properties, which map to the left or right side depending on the text direction.
## Example
ps-8
pe-8
ps-8
pe-8
This is tight text.
This is looser text.
[Try it Β»](#) * * * ## Letter Spacing Letter spacing controls the horizontal spacing between text characters. Tailwind uses tracking-{size} utility classes to adjust letter spacing. Common letter spacing values: * `tracking-tight`: Decreases letter spacing. * `tracking-normal`: Sets normal letter spacing. * `tracking-wide`: Increases letter spacing. * `tracking-{size}`: Sets letter spacing using the specified unit. ## ExampleTight text
Wide text
[Try it Β»](#) * * * ## Gap Gap is used to set the spacing between elements in a Grid layout or Flexbox layout. It adds spacing between all child elements, especially useful for creating consistent gaps in layouts. Common gap values: * `gap-0`: Sets the gap to 0. * `gap-1` to `gap-64`: Sets different gap values. ## Example01
02
03
04
YouTip