Spacing
The spacing utility was updated in 2026.01.2 to support logical properties alongside physical ones. See the logical properties example.
The custom specifiers horizontal, vertical, and around are deprecated. See Deprecated for details.
Usage
Use spacing utilities to apply margin and padding consistently across the system.
Use the pattern env-{property}-{specifier}--{size}, or use the shorthand
env-{property}--{size} to apply spacing to all sides.
Valid values
{property}
mmarginppadding
{specifier}
Physical and logical properties are both supported. Logical properties are recommended for spacing within components and internationalized content, while physical properties remain useful for overall layout and dimensions.
toprightbottomleftblock-startinline-endblock-endinline-startblockblock-start & block-end shorthandinlineinline-start & inline-end shorthand{omitted}block and inline shorthand
{size}
0No marginaauto, only applicable to marginxxx-small(0.125em)xx-small(0.25em)x-small(0.5em)small(0.75em)medium(1em)large(1.25em)x-large(1.5em)xx-large(1.75em)xxx-large(2em)
Negative margin
Negative margin is applied by combining a size class with the --negative modifier. Negative values are only available for margin.
Example:
<div class="env-m-inline--large env-m-inline--negative">...</div>
Spacing examples
env-p--medium
env-p-block--large
env-m-inline--negative
env-m-block--medium
env-p--small
env-m-block-start--medium
env-m-inline-end--medium
env-m-block-end--small
env-m-inline-start--xxx-large
env-p--medium
env-m-block--medium
env-m-inline--a
env-p--medium
Logical properties example
Logical properties are based on the content’s writing flow instead of physical sides. This allows spacing to adapt naturally to different languages and writing modes.
All of the examples below use the same classes:
env-m-block-start--medium, env-p--x-small, env-p-block-start--0, env-p-inline-end--xx-large
Read more about CSS logical properties and values (MDN) .
Deprecated
Since 2026.02.1, the following custom specifiers are deprecated:
horizontaluseinlinefor direction-aware spacing, orleftandrightfor physical spacingverticaluseblockfor direction-aware spacing, ortopandbottomfor physical spacingarounduse the shorthand by omitting the specifier