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: 80px;
padding: 20px;
border: 5px solid black;
margin: 15px;
} -
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: 270px;
padding: 25px;
border: 1px solid black;
margin: 15px;
} -
3.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 250px;
padding: 30px;
border: 1px solid black;
margin: 5px;
} -
4.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 80px;
padding: 30px;
border: 4px solid black;
margin: 15px;
} -
5.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 110px;
padding: 5px;
border: 3px solid black;
margin: 20px;
} -
6.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 230px;
padding: 25px;
border: 3px solid black;
margin: 5px;
} -
7.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 140px;
padding: 20px;
border: 3px solid black;
margin: 20px;
} - 8.📦 In the box model, which part is the line round the box? (a) content (b) margin (c) border (d) padding
- 9.Which of these is padding? (a) space inside the border (b) the gap to other boxes (c) a solid or dotted edge (d) the line round the box
-
10.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 180px;
padding: 5px;
border: 5px solid black;
margin: 5px;
} - 11.True or false: the content is space inside the border. (a) True (b) False
- 12.Which of these is the content? (a) the line round the box (b) the text or picture (c) the gap round content (d) space inside the border
- 13.Which of these is padding? (a) the gap round content (b) the gap to other boxes (c) the text or picture (d) space outside the border
-
14.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 50px;
padding: 5px;
border: 2px solid black;
margin: 5px;
} -
15.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 230px;
padding: 30px;
border: 3px solid black;
margin: 5px;
} -
16.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 80px;
padding: 5px;
border: 1px solid black;
margin: 10px;
} - 17.Which of these is margin? (a) the text or picture (b) space outside the border (c) the gap round content (d) the line round the box
- 18.📦 In the box model, which part is the gap round content? (a) margin (b) border (c) content (d) padding
- 19.📦 In the box model, which part is the gap to other boxes? (a) border (b) margin (c) content (d) padding
- 20.📦 In the box model, which part is space outside the border? (a) margin (b) border (c) padding (d) content
-
21.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 170px;
padding: 5px;
border: 2px solid black;
margin: 5px;
} -
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: 25px;
border: 2px solid black;
margin: 10px;
} -
23.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 60px;
padding: 15px;
border: 5px solid black;
margin: 20px;
} - 24.📦 In the box model, which part is a solid or dotted edge? (a) padding (b) margin (c) border (d) content
-
25.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 60px;
padding: 10px;
border: 5px solid black;
margin: 0px;
} - 26.📦 In the box model, which part is space inside the border? (a) margin (b) content (c) border (d) padding
- 27.True or false: padding is the line round the box. (a) False (b) True
-
28.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 130px;
padding: 15px;
border: 1px solid black;
margin: 20px;
} - 29.Which of these is the border? (a) the gap round content (b) the text or picture (c) a solid or dotted edge (d) space outside the border
-
30.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 90px;
padding: 10px;
border: 3px solid black;
margin: 5px;
} -
31.📦 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: 15px;
border: 3px solid black;
margin: 0px;
} -
32.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 200px;
padding: 25px;
border: 5px solid black;
margin: 0px;
} -
33.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 110px;
padding: 25px;
border: 4px solid black;
margin: 15px;
} -
34.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 140px;
padding: 10px;
border: 3px solid black;
margin: 20px;
} -
35.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 80px;
padding: 5px;
border: 3px solid black;
margin: 0px;
} -
36.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 140px;
padding: 5px;
border: 3px solid black;
margin: 5px;
} -
37.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 50px;
padding: 25px;
border: 1px solid black;
margin: 10px;
} -
38.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 130px;
padding: 30px;
border: 5px solid black;
margin: 5px;
} -
39.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 60px;
padding: 25px;
border: 3px solid black;
margin: 15px;
} -
40.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 300px;
padding: 10px;
border: 3px solid black;
margin: 5px;
}
Answer key
- 160
- 322
- 322
- 178
- 166
- 296
- 186
- border
- space inside the border
- 210
- False
- the text or picture
- the gap round content
- 74
- 306
- 112
- space outside the border
- padding
- margin
- margin
- 184
- 354
- 140
- border
- 90
- padding
- False
- 202
- a solid or dotted edge
- 126
- 336
- 260
- 198
- 166
- 96
- 166
- 122
- 200
- 146
- 336
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids