Box Sizing — exercises and bug fixes
5 hands-on exercises and 5 find-the-bug challenges for the Box Sizing lesson. Every one is checked automatically in the browser — write the code, run it, and the tests tell you what still fails.
Exercises(5)
- 1
Switch to border-box
easy10 minMake #box use border-box sizing.
- 2
Keep the width with padding
easy10 minSet 200px wide with 20px padding under border-box.
- 3
Include the border too
easy10 minAdd a 5px border and keep the box 200px wide.
- 4
Apply it globally
easy10 minSet border-box on every element with the universal selector.
- 5
Compare with content-box
medium10 minExplicitly set content-box on the parent and border-box on the box.
Find the bug(5)
- 1
Fix the content-box overflow
easy8 minPadding is widening the box past 200px.
- 2
Fix the misspelled value
easy8 minThe value is border-box, not box-border.
- 3
Fix the misspelled property
easy8 minThe property is box-sizing, not sizing.
- 4
Fix the rule applied too narrowly
easy8 minOnly the box got border-box; the parent needs it too.
- 5
Fix the border pushing the width out
easy8 minUnder content-box the 5px border adds to the 200px.
Ready to write the code?
The editor, the automatic checks and the worked solutions open up with an account.
Open the workspace