0
0
CSSmarkup~20 mins

Box sizing in CSS - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Box Sizing Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding box-sizing property
Which box-sizing value makes the width and height include padding and border?
Aborder-box
Bcontent-box
Cpadding-box
Dmargin-box
Attempts:
2 left
💡 Hint
Think about which option makes the box size include everything inside the border.
📝 Syntax
intermediate
2:00remaining
Correct CSS syntax for box-sizing
Which CSS snippet correctly sets the box-sizing to border-box for all elements?
CSS
/* Choose the correct CSS code */
A* { box-sizing: border box; }
B* { box-sizing: borderbox; }
C* { box-sizing: border_box; }
D* { box-sizing: border-box; }
Attempts:
2 left
💡 Hint
Check the spelling and syntax of the value.
rendering
advanced
2:00remaining
Visual effect of box-sizing on element size
Given this CSS and HTML, what is the total width of the div in pixels?

div { width: 200px; padding: 20px; border: 5px solid black; box-sizing: content-box; }

<div>Box</div>
A200px
B250px plus margin
C250px
D250px plus padding
Attempts:
2 left
💡 Hint
Remember that with content-box, padding and border add to the width.
selector
advanced
2:00remaining
Applying box-sizing to specific elements
Which CSS selector applies box-sizing: border-box; only to all input and textarea elements?
Ainput & textarea { box-sizing: border-box; }
Binput, textarea { box-sizing: border-box; }
Cinput + textarea { box-sizing: border-box; }
Dinput textarea { box-sizing: border-box; }
Attempts:
2 left
💡 Hint
Look for the selector that targets both elements separately.
accessibility
expert
2:00remaining
Box-sizing and accessibility for responsive design
Why is setting box-sizing: border-box; on all elements important for accessible responsive layouts?
AIt ensures padding and borders do not increase element size, preventing layout shifts on zoom or font resize.
BIt disables user zoom to keep layout fixed.
CIt hides overflow content to avoid scrollbars.
DIt automatically adjusts font size based on screen width.
Attempts:
2 left
💡 Hint
Think about how box-sizing affects element size when users zoom or change font size.