9
Can we talk about how often people mix up margin and padding in CSS?
I finally figured out the difference after my layout broke three times in a row on a simple page for a local bakery site, and now I keep seeing beginners in forums adding margin to everything when padding would fix their spacing issues, has anyone else noticed this mistake popping up everywhere?
2 comments
Log in to join the discussion
Log In2 Comments
ivanl761mo agoMost Upvoted
Kept slapping margins on everything until a buddy forced me to open DevTools and watch what each one actually did.
3
nina_sullivan611mo ago
Started using padding for everything after I rebuilt my portfolio site three times. DevTools saved me too, but I still catch myself adding random margins out of habit. Feels like one of those things you have to mess up a bunch before it clicks.
3