CSS Worksheet: Box Model
Code tip (Inside out, twice): From the inside out: content → padding → border → margin. Border to border = width + 2 × padding + 2 × border. Total space = width + 2 × padding + 2 × border + 2 × margin.
NameDateTime takenScore ___ / 40
-
1.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 110px;
padding: 25px;
border: 4px solid black;
margin: 20px;
} -
2.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 240px;
padding: 15px;
border: 1px solid black;
margin: 10px;
} - 3.Which of these is margin? (a) the gap round content (b) a solid or dotted edge (c) the gap to other boxes (d) the line round the box
-
4.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 90px;
padding: 10px;
border: 5px solid black;
margin: 5px;
} - 5.📦 In the box model, which part is the gap round content? (a) margin (b) padding (c) border (d) content
-
6.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 60px;
padding: 20px;
border: 2px solid black;
margin: 0px;
} - 7.📦 In the box model, which part is the text or picture? (a) border (b) margin (c) content (d) padding
-
8.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 290px;
padding: 5px;
border: 3px solid black;
margin: 5px;
} -
9.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 90px;
padding: 20px;
border: 1px solid black;
margin: 0px;
} - 10.True or false: margin is space outside the border. (a) False (b) True
-
11.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 110px;
padding: 25px;
border: 2px solid black;
margin: 10px;
} -
12.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 160px;
padding: 20px;
border: 5px solid black;
margin: 20px;
} - 13.True or false: margin is the gap to other boxes. (a) False (b) True
-
14.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 140px;
padding: 20px;
border: 4px solid black;
margin: 10px;
} -
15.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 40px;
padding: 20px;
border: 1px solid black;
margin: 0px;
} - 16.Which of these is padding? (a) the text or picture (b) space inside the border (c) space outside the border (d) the gap to other boxes
- 17.Which of these is the content? (a) the text or picture (b) space outside the border (c) the gap round content (d) the gap to other boxes
- 18.True or false: margin is the line round the box. (a) False (b) True
-
19.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 180px;
padding: 20px;
border: 5px solid black;
margin: 10px;
} -
20.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 60px;
padding: 30px;
border: 4px solid black;
margin: 20px;
} -
21.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 200px;
padding: 5px;
border: 4px solid black;
margin: 20px;
} -
22.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 300px;
padding: 5px;
border: 3px solid black;
margin: 15px;
} - 23.True or false: padding is space inside the border. (a) True (b) False
-
24.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 90px;
padding: 5px;
border: 4px solid black;
margin: 0px;
} -
25.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 260px;
padding: 25px;
border: 3px solid black;
margin: 5px;
} - 26.Which of these is padding? (a) the gap round content (b) space outside the border (c) the text or picture (d) a solid or dotted edge
- 27.📦 In the box model, which part is space inside the border? (a) margin (b) content (c) padding (d) border
-
28.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 160px;
padding: 10px;
border: 1px solid black;
margin: 15px;
} -
29.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 230px;
padding: 10px;
border: 5px solid black;
margin: 10px;
} - 30.Which of these is margin? (a) the line round the box (b) a solid or dotted edge (c) the text or picture (d) space outside the border
- 31.True or false: padding is a solid or dotted edge. (a) True (b) False
- 32.True or false: the content is space inside the border. (a) False (b) True
- 33.Which of these is the border? (a) the gap round content (b) the text or picture (c) the line round the box (d) space inside the border
- 34.📦 In the box model, which part is the gap to other boxes? (a) padding (b) margin (c) border (d) content
-
35.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 240px;
padding: 30px;
border: 2px solid black;
margin: 0px;
} -
36.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 220px;
padding: 20px;
border: 1px solid black;
margin: 0px;
} - 37.True or false: padding is the gap round content. (a) False (b) True
-
38.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 240px;
padding: 30px;
border: 1px solid black;
margin: 0px;
} -
39.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 180px;
padding: 5px;
border: 4px solid black;
margin: 0px;
} - 40.📦 In the box model, which part is the line round the box? (a) content (b) margin (c) padding (d) border
Answer key
- 208
- 272
- the gap to other boxes
- 130
- padding
- 104
- content
- 306
- 132
- True
- 164
- 250
- True
- 208
- 82
- space inside the border
- the text or picture
- False
- 250
- 168
- 258
- 316
- True
- 108
- 316
- the gap round content
- padding
- 182
- 260
- space outside the border
- False
- False
- the line round the box
- margin
- 304
- 262
- True
- 302
- 198
- border
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids