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.📦 In the box model, which part is the gap round content? (a) margin (b) border (c) content (d) padding
-
2.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 200px;
padding: 10px;
border: 3px solid black;
margin: 5px;
} - 3.True or false: padding is the gap to other boxes. (a) True (b) False
- 4.True or false: the border is space inside the border. (a) False (b) True
- 5.Which of these is the content? (a) the gap round content (b) the text or picture (c) space outside the border (d) the line round the box
- 6.Which of these is padding? (a) space outside the border (b) a solid or dotted edge (c) the gap to other boxes (d) the gap round content
- 7.True or false: margin is the line round the box. (a) False (b) True
-
8.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 120px;
padding: 20px;
border: 2px solid black;
margin: 5px;
} - 9.Which of these is the border? (a) the text or picture (b) a solid or dotted edge (c) the gap to other boxes (d) space outside the border
-
10.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 300px;
padding: 5px;
border: 5px solid black;
margin: 5px;
} - 11.True or false: the border is a solid or dotted edge. (a) False (b) True
-
12.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 290px;
padding: 20px;
border: 4px solid black;
margin: 15px;
} - 13.📦 In the box model, which part is space inside the border? (a) margin (b) padding (c) border (d) content
-
14.📦 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: 5px;
} - 15.True or false: margin is the gap to other boxes. (a) False (b) True
- 16.📦 In the box model, which part is the text or picture? (a) border (b) padding (c) margin (d) content
-
17.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 170px;
padding: 5px;
border: 2px solid black;
margin: 20px;
} - 18.True or false: the content is the text or picture. (a) True (b) False
- 19.True or false: padding is the gap round content. (a) True (b) False
-
20.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 50px;
padding: 5px;
border: 3px solid black;
margin: 0px;
} - 21.True or false: padding is space inside the border. (a) False (b) True
-
22.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 190px;
padding: 15px;
border: 1px solid black;
margin: 15px;
} -
23.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 170px;
padding: 30px;
border: 2px solid black;
margin: 5px;
} -
24.📦 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: 15px;
border: 4px solid black;
margin: 0px;
} -
25.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 90px;
padding: 10px;
border: 3px solid black;
margin: 20px;
} - 26.📦 In the box model, which part is space outside the border? (a) border (b) margin (c) padding (d) content
- 27.True or false: margin is space outside the border. (a) False (b) True
-
28.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 120px;
padding: 5px;
border: 3px solid black;
margin: 15px;
} -
29.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 250px;
padding: 30px;
border: 2px solid black;
margin: 20px;
} -
30.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 50px;
padding: 10px;
border: 2px solid black;
margin: 10px;
} -
31.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 110px;
padding: 10px;
border: 3px solid black;
margin: 0px;
} -
32.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 170px;
padding: 5px;
border: 1px solid black;
margin: 15px;
} -
33.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 300px;
padding: 30px;
border: 1px solid black;
margin: 0px;
} -
34.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 50px;
padding: 30px;
border: 2px solid black;
margin: 15px;
} - 35.📦 In the box model, which part is the gap to other boxes? (a) border (b) padding (c) content (d) margin
-
36.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 50px;
padding: 20px;
border: 5px solid black;
margin: 5px;
} - 37.True or false: padding is space outside the border. (a) True (b) False
-
38.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 150px;
padding: 25px;
border: 1px solid black;
margin: 15px;
} -
39.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 160px;
padding: 20px;
border: 5px solid black;
margin: 0px;
} -
40.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 60px;
padding: 5px;
border: 1px solid black;
margin: 20px;
}
Answer key
- padding
- 236
- False
- False
- the text or picture
- the gap round content
- False
- 174
- a solid or dotted edge
- 330
- True
- 368
- padding
- 316
- True
- content
- 224
- True
- True
- 66
- True
- 252
- 244
- 198
- 156
- margin
- True
- 166
- 354
- 94
- 136
- 212
- 362
- 144
- margin
- 110
- False
- 232
- 210
- 72
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids