CSS margin Property Explained

What the CSS margin property does, with an example.

Published November 4, 2026

The CSS margin property sets the space outside an element's border, between it and neighboring elements.

Key points

  • Check browser compatibility on a resource like caniuse.com if targeting older browsers

Example

margin: 0 auto;
More CSS articles