Skip to content
Box model

The CSS margin property

Sets the space outside an element. Vertical margins can collapse instead of adding together.

2,119 effects in the catalog use this property.

Syntax

margin: <top> <right> <bottom> <left>;

Watch out

Adjacent vertical margins collapse, so the larger margin wins rather than the two being added. Margins do not collapse inside flex and grid layouts, where `gap` is usually more predictable.

Common values

0 auto
Center a fixed-width block horizontally

Effects using margin

All CSS properties

These are working effects from the catalog. Open a tile to inspect the full source.