Predict Content-Box Width
Predict Output Easy
Question
With the default box-sizing (content-box), what is the total rendered width?
Code
div {
/* box-sizing defaults to content-box */
width: 200px;
padding: 20px;
border: 5px solid black;
}
Hint
content-box adds padding and border on top of the declared width.
Explanation
With content-box (the default), the width property only sets the content width. Padding and border are added on top: 200 (content) + 40 (padding: 20px left + 20px right) + 10 (border: 5px left + 5px right) = 250px total.
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.