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

Kevin Powell on YouTubeWatch on YouTube

SaveMark complete

Sign in to save videos and track what you’ve finished.

IntermediateUI23 min

About this video

A CSS tutorial explaining how collapsing margins work and how to deal with them, using a global reset of margin and padding, and changing how padding and border are calculated with box-sizing. It is aimed at people already learning CSS layout.

What you’ll learn

  • Explain when vertical margins collapse and how to avoid it
  • Apply a global reset of margin and padding
  • Use box-sizing to control how padding and border are calculated