Predict the Box Model Width
Predict Output Easy
Question
With box-sizing: border-box, what is the total rendered width?
Code
div {
box-sizing: border-box;
width: 200px;
padding: 20px;
border: 5px solid black;
}
Hint
border-box includes padding and border in the declared width.
Explanation
With box-sizing: border-box, the declared width (200px) includes the content, padding, and border. So the total rendered width is exactly 200px. Without border-box (content-box), it would be 200 + 40 + 10 = 250px.
Related Resources
Related Lessons
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.