Uploaded March 2026 | Updated November 2026, 3 hours ago
Spacing on the web seems simple, but suddenly margins inexplicably collapse (or stop collapsing), padding is inconsistent in strange ways, and your layouts look off balance for reasons you don’t understand. In this video, Kevin explores how to take control of spacing through margins, padding, and gaps, and also explores the new box-trim properties and values.
First Example CodePen: codepen.io/kevinpowell/pen/WNVaqeZ
Second Example CodePen: codepen.io/kevinpowell/pen/jENxeXV
Kevin Powell’s courses on Frontend Masters: frontendmasters.com/teachers/kevin-powell
Find Frontend Masters Online:
Twitter: twitter.com/FrontendMasters
LinkedIn: linkedin.com/company/frontend-masters
Facebook: facebook.com/FrontendMasters
Instagram: instagram.com/FrontendMasters
TikTok: tiktok.com/@frontendmasters
About Us:
Advance your skills with in-depth, modern front-end engineering courses — our 250+ high-quality courses and 24 curated learning paths will guide you from mid-level to senior developer! Start your path to mastery today: frontendmasters.com/?utm_source=youtube&utm_medium=home_link&utm_campaign=exlusive
Spacing on the web seems simple, but suddenly margins inexplicably collapse (or stop collapsing), padding is inconsistent in strange ways, and your layouts look off balance for reasons you don’t understand. In this video, Kevin explores how to take control of spacing through margins, padding, and gaps, and also explores the new box-trim properties and values.
First Example CodePen: codepen.io/kevinpowell/pen/WNVaqeZ
Second Example CodePen: codepen.io/kevinpowell/pen/jENxeXV
Kevin Powell’s courses on Frontend Masters: frontendmasters.com/teachers/kevin-powell
Find Frontend Masters Online:
Twitter: twitter.com/FrontendMasters
LinkedIn: linkedin.com/company/frontend-masters
Facebook: facebook.com/FrontendMasters
Instagram: instagram.com/FrontendMasters
TikTok: tiktok.com/@frontendmasters
About Us:
Advance your skills with in-depth, modern front-end engineering courses — our 250+ high-quality courses and 24 curated learning paths will guide you from mid-level to senior developer! Start your path to mastery today: frontendmasters.com/?utm_source=youtube&utm_medium=home_link&utm_campaign=exlusive










