HTML & CSS That Holds Up

Lesson 3 · blocks HTML & CSS That Holds Up

The Box Model & Cascade

Predict an element's size and which rule wins.

Before you start

Two rules explain most CSS confusion. First: an element's rendered width is content + padding + border, unless box-sizing: border-box makes width mean the whole box. Second: specificity — id beats class beats element — decides ties, and !important is a confession, not a fix.

5 exercises·up to 72 XP·5/5 hearts