CSS: getting started

Lesson 02 · 11 min

The box: margin, border, padding

Every element is a rectangle. A "300px" width without border-box lies.

Outside is margin, then border, inside is padding, then content. box-sizing: border-box counts padding and border inside the width — put it on *, otherwise width: 100% + padding spills out of the parent.

Sign in to continue

The rest of this lesson opens after sign up

The first lesson of every course is open without an account. To read on, solve the practice and use Ask, create a free account or log in.