Key Concepts

Review core concepts you need to learn to master this subject

CSS Margin Collapse

/* The vertical margins will collapse to 30 pixels instead of adding to 50 pixels. */ .block-one { margin: 20px; } .block-two { margin: 30px; }

CSS margin collapse occurs when the top and bottom margins of blocks are combined into a single margin equal to the largest individual block margin.

Margin collapse only occurs with vertical margins, not for horizontal margins.

The Box Model
Lesson 1 of 2

What you'll create

Portfolio projects that showcase your new skills

Pro Logo

How you'll master it

Stress-test your knowledge with quizzes that help commit syntax to memory

Pro Logo