It was never so easy to get YouTube subscribers
Get Free YouTube Subscribers, Views and Likes

Margin and Padding Deep Dive: Collapsing margins resets and CSS box-sizing

Follow
Kevin Powell

Collapsing margins are easily one of the most confusing behaviours for people who are just getting into CSS, mainly because it's really not very intuitive at all.

In this video, I look at what collapsing margins are, and how you can deal with them.

After that, I also look at using a global reset of margin and padding so that we don't have to deal with the defaults, which can really help out beginners.

And lastly, we look at the boxsizing property, and it can be used to change the way padding (and border) are calculated, all which make our life a lot easier.

This video is all about trying to really understand the more nuanced parts of CSS margins and padding, so that you don't run into strange behaviours and being able to change a few settings to make your life a lot easier.

CodePen links:
https://codepen.io/kevinpowell/pen/e6...
https://codepen.io/kevinpowell/pen/b6...


Part 1: The Very Basics    • Margin and Padding Deep Dive: The basics  
Part 2: Collapsing margins and boxsizing (this video)
Part 3: Using Whitespace effectively    • Margin and Padding Deep Dive: Using w...  



My Code Editor: VS Code https://code.visualstudio.com/

How my browser refreshes when I save:    • How to automatically refresh your bro...  



Support me on Patreon:   / kevinpowell  

I'm on some other places on the internet too!

If you'd like a behind the scenes and previews of what's coming up on my YouTube channel, make sure to follow me on Instagram and Twitter.

Instagram:   / kevinpowell.co  
Twitter:   / kevinjpowell  
Codepen: https://codepen.io/kevinpowell/
Github: https://github.com/kevinpowell

posted by verovivan5