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 wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 190px;
padding: 10px;
border: 3px solid black;
margin: 0px;
} -
2.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 280px;
padding: 15px;
border: 1px solid black;
margin: 20px;
} -
3.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 280px;
padding: 15px;
border: 2px solid black;
margin: 0px;
} -
4.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 200px;
padding: 5px;
border: 1px solid black;
margin: 0px;
} -
5.📦 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: 15px;
border: 3px solid black;
margin: 5px;
} - 6.True or false: the content is the gap round content. (a) False (b) True
- 7.True or false: padding is the gap round content. (a) False (b) True
-
8.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 160px;
padding: 25px;
border: 1px solid black;
margin: 20px;
} -
9.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 150px;
padding: 5px;
border: 5px solid black;
margin: 5px;
} -
10.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 200px;
padding: 10px;
border: 2px solid black;
margin: 10px;
} -
11.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 200px;
padding: 30px;
border: 5px solid black;
margin: 15px;
} -
12.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 80px;
padding: 20px;
border: 1px 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: 80px;
padding: 30px;
border: 1px solid black;
margin: 20px;
} -
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: 270px;
padding: 30px;
border: 4px solid black;
margin: 0px;
} -
15.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 60px;
padding: 15px;
border: 3px solid black;
margin: 0px;
} -
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: 140px;
padding: 5px;
border: 3px solid black;
margin: 15px;
} -
17.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 90px;
padding: 5px;
border: 3px solid black;
margin: 20px;
} -
18.📦 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: 10px;
border: 1px solid black;
margin: 20px;
} - 19.📦 In the box model, which part is the text or picture? (a) padding (b) margin (c) content (d) border
-
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: 260px;
padding: 25px;
border: 3px solid black;
margin: 5px;
} - 21.True or false: the border is a solid or dotted edge. (a) True (b) False
- 22.📦 In the box model, which part is a solid or dotted edge? (a) content (b) padding (c) margin (d) border
- 23.📦 In the box model, which part is the gap to other boxes? (a) content (b) border (c) margin (d) padding
- 24.Which of these is the border? (a) space inside the border (b) space outside the border (c) a solid or dotted edge (d) the gap to other boxes
-
25.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 160px;
padding: 5px;
border: 2px solid black;
margin: 15px;
} - 26.📦 In the box model, which part is space inside the border? (a) content (b) border (c) padding (d) margin
- 27.True or false: margin is space inside the border. (a) False (b) True
- 28.Which of these is margin? (a) a solid or dotted edge (b) the gap round content (c) space inside the border (d) space outside the border
- 29.True or false: the border is space outside the border. (a) False (b) True
-
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: 200px;
padding: 10px;
border: 4px solid black;
margin: 10px;
} - 31.Which of these is the content? (a) the gap round content (b) a solid or dotted edge (c) the line round the box (d) the text or picture
- 32.True or false: the content is the line round the box. (a) True (b) False
- 33.📦 In the box model, which part is space outside the border? (a) padding (b) border (c) content (d) margin
- 34.True or false: the border is space inside the border. (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: 150px;
padding: 5px;
border: 2px solid black;
margin: 20px;
} -
36.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 140px;
padding: 20px;
border: 4px solid black;
margin: 5px;
} - 37.True or false: padding is the text or picture. (a) True (b) False
- 38.True or false: padding is the line round the box. (a) True (b) False
-
39.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 190px;
padding: 25px;
border: 3px solid black;
margin: 0px;
} -
40.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 260px;
padding: 10px;
border: 1px solid black;
margin: 5px;
}
Answer key
- 216
- 352
- 314
- 212
- 86
- False
- True
- 252
- 180
- 244
- 300
- 142
- 142
- 338
- 96
- 156
- 146
- 292
- content
- 316
- True
- border
- margin
- a solid or dotted edge
- 204
- padding
- False
- space outside the border
- False
- 228
- the text or picture
- False
- margin
- False
- 164
- 198
- False
- False
- 246
- 292
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids