The rules of margin collapse | Josh W Comeau

A brilliant overview of all the weird edge-cases that exist with the CSS margin attribute. Honestly, having used CSS for over a decade I'm not sure I've run into any of them before (maybe parent inheritance a couple of times?) so I'm still unconvinced by the call to abandon margin in favour of spacer components but I do agree that gap is a generally more useful attribute to reach for.

Explore Other Notes

Older âž¡

Favourite fonts of 2020

When ilt recommends a font, I listen. When they recommend a whole batch, I bookmark it for future reference 😉 Particular favourites from a first […]
  • A brilliant overview of all the weird edge-cases that exist with the CSS margin attribute. Honestly, having used CSS for over a decade I'm not sure I've run into any of them before (maybe parent […]
  • Murray Adcock.
Journal permalink

Made By Me, But Made Possible By:

CMS:

Build: Gatsby

Deployment: GitHub

Hosting: Netlify

Connect With Me:

Twitter Twitter

Instagram Instragram

500px 500px

GitHub GitHub

Keep Up To Date:

All Posts RSS feed.

Articles RSS feed.

Journal RSS feed.

Notes RSS feed.