Smashing Magazine Icon Smashing Magazine

Everything you need to know about CSS margins  ↦

Margins in CSS seem simple enough at first glance. Applied to an element it forms a space around the element, pushing other elements away. However, there is more to a margin than you might think.

No kidding! Margin collapsing has got to be one of the hardest things about CSS for new developers, and this article not only goes into it and how to avoid it, but explains the “why” behind it.


Discussion

Sign in or Join to comment or subscribe

Player art
  0:00 / 0:00