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: 20px;
border: 5px solid black;
margin: 0px;
} -
2.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 150px;
padding: 30px;
border: 4px solid black;
margin: 0px;
} -
3.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 130px;
padding: 25px;
border: 1px solid black;
margin: 0px;
} - 4.📦 In the box model, which part is the gap to other boxes? (a) content (b) border (c) padding (d) margin
- 5.True or false: padding is space inside the border. (a) True (b) False
- 6.Which of these is padding? (a) space outside the border (b) the gap round content (c) a solid or dotted edge (d) the gap to other boxes
- 7.Which of these is the content? (a) the gap round content (b) the gap to other boxes (c) the text or picture (d) space inside the border
- 8.Which of these is margin? (a) the gap to other boxes (b) the text or picture (c) the gap round content (d) space inside the border
- 9.📦 In the box model, which part is space inside the border? (a) margin (b) border (c) padding (d) content
-
10.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 220px;
padding: 15px;
border: 5px solid black;
margin: 5px;
} -
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: 20px;
border: 4px solid black;
margin: 20px;
} - 12.Which of these is the border? (a) the text or picture (b) space inside the border (c) the gap round content (d) a solid or dotted edge
-
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: 230px;
padding: 20px;
border: 2px solid black;
margin: 5px;
} - 14.True or false: the border is a solid or dotted edge. (a) False (b) True
- 15.📦 In the box model, which part is the text or picture? (a) margin (b) padding (c) content (d) border
-
16.📦 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: 10px;
border: 2px solid black;
margin: 5px;
} -
17.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 210px;
padding: 10px;
border: 4px solid black;
margin: 10px;
} - 18.📦 In the box model, which part is the line round the box? (a) border (b) content (c) margin (d) padding
- 19.True or false: the content is the text or picture. (a) False (b) True
-
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: 160px;
padding: 5px;
border: 4px solid black;
margin: 20px;
} -
21.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 130px;
padding: 10px;
border: 3px solid black;
margin: 5px;
} -
22.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 60px;
padding: 30px;
border: 3px solid black;
margin: 20px;
} - 23.Which of these is margin? (a) space outside the border (b) space inside the border (c) the gap round content (d) a solid or dotted edge
-
24.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 190px;
padding: 25px;
border: 3px solid black;
margin: 20px;
} -
25.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 110px;
padding: 10px;
border: 3px solid black;
margin: 0px;
} -
26.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 280px;
padding: 20px;
border: 3px solid black;
margin: 0px;
} -
27.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 270px;
padding: 25px;
border: 5px solid black;
margin: 0px;
} -
28.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 190px;
padding: 15px;
border: 4px solid black;
margin: 0px;
} -
29.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 110px;
padding: 15px;
border: 5px solid black;
margin: 15px;
} -
30.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 60px;
padding: 5px;
border: 3px solid black;
margin: 0px;
} - 31.📦 In the box model, which part is a solid or dotted edge? (a) padding (b) content (c) border (d) margin
- 32.True or false: the content is the gap to other boxes. (a) True (b) False
-
33.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 250px;
padding: 10px;
border: 4px solid black;
margin: 20px;
} - 34.True or false: padding is the gap round content. (a) False (b) True
-
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: 130px;
padding: 20px;
border: 5px solid black;
margin: 15px;
} -
36.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 150px;
padding: 15px;
border: 1px solid black;
margin: 15px;
} -
37.📦 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: 5px;
border: 5px solid black;
margin: 10px;
} - 38.True or false: margin is space outside the border. (a) False (b) True
-
39.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 40px;
padding: 10px;
border: 1px solid black;
margin: 20px;
} -
40.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 280px;
padding: 5px;
border: 5px solid black;
margin: 20px;
}
Answer key
- 160
- 218
- 182
- margin
- True
- the gap round content
- the text or picture
- the gap to other boxes
- padding
- 270
- 158
- a solid or dotted edge
- 274
- True
- content
- 314
- 238
- border
- True
- 178
- 166
- 166
- space outside the border
- 286
- 136
- 326
- 330
- 228
- 180
- 76
- border
- False
- 318
- True
- 180
- 212
- 130
- True
- 102
- 340
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids