Skip to content

Spacings

Spacing utilities are a set of responsive margin and padding utility classes to control an element’s spacing. They follow a consistent naming convention for intuitive use. 📏

The classes are named using a logical format: ro-u-{property}{direction}-{size}

  • Property: m for margin or p for padding.
  • Direction:
    • t - top (margin-top or padding-top)
    • b - bottom (margin-bottom or padding-bottom)
    • l - left (margin-left or padding-left)
    • r - right (margin-right or padding-right)
    • x - horizontal axis (-inline)
    • y - vertical axis (-block)
  • Size: A numeric scale from 0 to 14, a semantic size (xs-4xl), or 1/2. Margins also support negative sizes by prefixing the size with n (e.g., n4, n-xs).

Set margin on all four sides of an element.

<div class="ro-u-m-lg"></div>
Preview
ro-u-m-lg

Set horizontal (mx) or vertical (my) margins.

<div class="ro-u-my-xl ro-u-mx-4"></div>
Preview
ro-u-my-xl ro-u-mx-4

Set margin on a single side.

<div class="ro-u-mt-sm ro-u-ml-xl"></div>
Preview
ro-u-mt-sm ro-u-ml-xl

Set padding on all four sides of an element.

<div class="ro-u-p-lg">...</div>
Preview
ro-u-p-lg

Set horizontal (px) or vertical (py) padding.

<div class="ro-u-py-xl ro-u-px-4">...</div>
Preview
ro-u-py-xl ro-u-px-4

Set padding on a single side.

<div class="ro-u-pt-sm ro-u-pl-xl">...</div>
Preview
ro-u-pt-sm ro-u-pl-xl

PrefixCSS PropertyAvailable Sizes
mmargin0-14, Semantic (xs-4xl), 1/2, auto, and Negative versions of each.
mtmargin-top
mbmargin-bottom
mlmargin-left
mrmargin-right
mxmargin-inline
mymargin-block
PrefixCSS PropertyAvailable Sizes
ppadding0-14, Semantic (xs-4xl), and 1/2.
ptpadding-top
pbpadding-bottom
plpadding-left
prpadding-right
pxpadding-inline
pypadding-block