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: 180px;
padding: 30px;
border: 5px solid black;
margin: 0px;
} -
2.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 300px;
padding: 20px;
border: 4px solid black;
margin: 5px;
} -
3.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 200px;
padding: 15px;
border: 1px solid black;
margin: 10px;
} -
4.📦 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: 5px;
} -
5.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 140px;
padding: 20px;
border: 4px solid black;
margin: 10px;
} - 6.Which of these is margin? (a) the gap to other boxes (b) space inside the border (c) the gap round content (d) the text or picture
- 7.📦 In the box model, which part is the gap round content? (a) content (b) margin (c) padding (d) border
- 8.True or false: the content is the gap round content. (a) True (b) False
- 9.Which of these is the content? (a) the text or picture (b) space inside the border (c) the gap to other boxes (d) the line round the box
-
10.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 240px;
padding: 30px;
border: 1px solid black;
margin: 5px;
} - 11.True or false: padding is space inside the border. (a) False (b) True
-
12.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 100px;
padding: 5px;
border: 2px solid black;
margin: 10px;
} -
13.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 180px;
padding: 15px;
border: 5px solid black;
margin: 0px;
} -
14.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 150px;
padding: 10px;
border: 3px solid black;
margin: 0px;
} - 15.📦 In the box model, which part is the text or picture? (a) padding (b) margin (c) content (d) border
- 16.📦 In the box model, which part is the line round the box? (a) margin (b) padding (c) content (d) border
-
17.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 300px;
padding: 15px;
border: 2px solid black;
margin: 0px;
} - 18.True or false: padding is space outside the border. (a) True (b) False
- 19.Which of these is margin? (a) a solid or dotted edge (b) space outside the border (c) space inside the border (d) the line round the box
-
20.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 60px;
padding: 10px;
border: 4px solid black;
margin: 5px;
} - 21.True or false: the border is the text or picture. (a) True (b) False
- 22.True or false: the border is the line round the box. (a) False (b) True
- 23.📦 In the box model, which part is space inside the border? (a) border (b) padding (c) margin (d) content
-
24.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 300px;
padding: 15px;
border: 4px solid black;
margin: 10px;
} -
25.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 200px;
padding: 10px;
border: 3px solid black;
margin: 10px;
} -
26.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 170px;
padding: 10px;
border: 2px solid black;
margin: 10px;
} -
27.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 280px;
padding: 20px;
border: 3px solid black;
margin: 15px;
} - 28.True or false: the content is a solid or dotted edge. (a) False (b) True
-
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: 280px;
padding: 10px;
border: 3px solid black;
margin: 10px;
} -
30.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 90px;
padding: 30px;
border: 5px solid black;
margin: 5px;
} -
31.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 190px;
padding: 5px;
border: 4px solid black;
margin: 20px;
} -
32.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 190px;
padding: 5px;
border: 5px solid black;
margin: 0px;
} -
33.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 170px;
padding: 15px;
border: 5px solid black;
margin: 5px;
} -
34.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 40px;
padding: 25px;
border: 4px solid black;
margin: 5px;
} -
35.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 180px;
padding: 5px;
border: 4px solid black;
margin: 5px;
} -
36.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 80px;
padding: 5px;
border: 5px solid black;
margin: 10px;
} - 37.Which of these is padding? (a) the text or picture (b) the line round the box (c) space inside the border (d) space outside the border
- 38.Which of these is the border? (a) the line round the box (b) the text or picture (c) the gap round content (d) space outside the border
- 39.📦 In the box model, which part is the gap to other boxes? (a) margin (b) padding (c) border (d) content
-
40.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 110px;
padding: 15px;
border: 4px solid black;
margin: 20px;
}
Answer key
- 250
- 358
- 252
- 178
- 208
- the gap to other boxes
- padding
- False
- the text or picture
- 312
- True
- 134
- 220
- 176
- content
- border
- 334
- False
- space outside the border
- 98
- False
- True
- padding
- 358
- 246
- 214
- 356
- False
- 306
- 160
- 248
- 210
- 220
- 108
- 198
- 120
- space inside the border
- the line round the box
- margin
- 188
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids