Box Sizing Border Box
Multiple Choice Medium
Question
What does box-sizing: border-box do?
Hint
It changes how width is calculated.
Explanation
box-sizing: border-box makes the specified width include padding and border. So width: 100px with 10px padding and 2px border gives a content area of 76px, but the total element stays 100px. The default (content-box) adds padding and border on top of the width, often causing layout overflow issues.
Related Resources
Related Lessons
- CSS Box Model
Learn the CSS box model.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.