CSS
CSS MarginsCSS Margins
CSS margins create empty space completely outside an element.
Read Time
5 min readDifficulty
BeginnerLast Updated
Jun 15, 2026Version
v1.0.0Introduction
CSS creates transparent space around the outside of an element's border. Developers use margins to push elements apart from each other on the page. You can set the margin for all four sides independently.
Example
Example
Key Points
- Margins sit outside the element's border.
- The space is completely transparent.
- Margins push neighboring elements away.
- The `margin` shorthand sets all four sides at once.