The box model, online
Six activities your students do on their own devices. See who's finished, and their scores.
The box model in one minute
What students need to know
The content area is the core of the box model, holding the element's actual content. border-box is widely used because the element's total size matches the declared width.
The order outward is: content → padding → border → margin. Margin is the outermost layer — it separates the element from its neighbours.
Mistakes students make
- div.hover targets a div with class='hover', not all divs. To style all div elements, use div {} without a class selector.
- A colon is missing after the property name. It should be padding: 15px; not padding 15px;.
- The CSS property is color (American English), not colour. It should be color: red; not colour: red;.
- The property name is misspelled. It should be margin: 10px; not margn: 10px;.
What students will learn in this module
Every question in Module 45
Quick questions
- Which layer sits directly outside the content area?ApaddingBmargin
- Which layer sits outside the border?ApaddingBmargin
- By default, does width apply to the content area only, or include padding and border?Aincludes padding and borderBcontent area only
- Which box-sizing value makes width include padding and border?Aborder-boxBcontent-box
- Is padding inside or outside the border?AinsideBoutside
Key terms
Students type the meaning of:
box model
Match the pairs
padding: 20px;Match it to what it doesmargin: 10px;Match it to what it doesThe innermost layer — where text and child elements sitMatch it to what it doesMakes width and height include padding and borderMatch it to what it doesborder 2px solid black;Match it to what it doesmargn: 10px;Match it to what it doesFill in the blanks
div { _______ 20px; border: 1px solid gray; }Hint: Type the box model property that adds space between the content and the border
div { padding: 20px; ______: 10px; }Hint: Type the box model property that adds space outside the border
div { _____: 200px; padding: 10px; }Hint: Type the box model property that sets the width of the content area
div { border: ___ solid black; margin: 5px; }Hint: Type a pixel value for the border thickness
div { box-sizing: __________; width: 100px; }Hint: Type the box-sizing value that includes padding and border inside the width
Spot the error
Question 1
Adiv.hover {B padding: 10px;C margin: 5px;
Question 2
Adiv {B padding 15px;C margin: 10px;
Question 3
Adiv {B border: 2px solid black;C colour: red;
Question 4
Adiv {B width: 200px;C padding: 20px;D margn: 10px;
Question 5
Adiv {B width: 100px;C padding: 10px;D border: 1px solid gray;E box-sizing: content-box
