Spacing

Padding and margin on every side, both axes and logical directions.

1 min readv1

Sides and axes#

Padding

Margin

all

p

m

top · right · bottom · left

pt pr pb pl

mt mr mb ml

horizontal · vertical

px py

mx my

logical inline (start/end)

pi pis pie

mi mis mie

logical block (start/end)

pblk pblks pblke

mblk mblks mblke

Values are standard CSS: p=16px, p=8px 16px, m=0 auto, mt=-4px, p=$space.md.

HTML
p=24px
px=24px; py=8px
<div nib="d=flex; g=12px; ali=flex-start">
  <div nib="p=24px; bgc=#EEEFFE; cl=#312e81; bdrd=8px; fts=12px">p=24px</div>
  <div nib="px=24px; py=8px; bgc=#ecfeff; cl=#155e75; bdrd=8px; fts=12px">px=24px; py=8px</div>
</div>

Logical properties and RTL#

mis / mie (margin-inline-start/end) follow the writing direction, so layouts mirror automatically in right-to-left languages. Prefer them over ml / mr in multilingual products. See RTL.

Gap instead of margins#

Inside flex and grid containers, g spaces children without margins on each child — no "last item" exception needed.

All spacing shorthands#

Shorthand

CSS property

p

padding

px

padding-left + padding-right

py

padding-top + padding-bottom

pt

padding-top

pr

padding-right

pb

padding-bottom

pl

padding-left

pi

padding-inline

pis

padding-inline-start

pie

padding-inline-end

pblk

padding-block

pblks

padding-block-start

pblke

padding-block-end

m

margin

mx

margin-left + margin-right

my

margin-top + margin-bottom

mt

margin-top

mr

margin-right

mb

margin-bottom

ml

margin-left

mi

margin-inline

mis

margin-inline-start

mie

margin-inline-end

mblk

margin-block

mblks

margin-block-start

mblke

margin-block-end

Next steps#