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: 5px;
border: 4px solid black;
margin: 20px;
} -
2.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 250px;
padding: 5px;
border: 1px solid black;
margin: 20px;
} - 3.📦 In the box model, which part is a solid or dotted edge? (a) padding (b) content (c) margin (d) border
-
4.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 150px;
padding: 10px;
border: 3px solid black;
margin: 20px;
} -
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: 260px;
padding: 25px;
border: 2px solid black;
margin: 5px;
} - 6.📦 In the box model, which part is space inside the border? (a) padding (b) border (c) margin (d) content
-
7.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 250px;
padding: 15px;
border: 4px solid black;
margin: 10px;
} - 8.True or false: padding is a solid or dotted edge. (a) True (b) False
- 9.📦 In the box model, which part is the gap round content? (a) content (b) margin (c) border (d) padding
- 10.True or false: the border is a solid or dotted edge. (a) True (b) False
- 11.📦 In the box model, which part is space outside the border? (a) margin (b) content (c) padding (d) border
- 12.True or false: margin is the text or picture. (a) False (b) True
- 13.Which of these is the border? (a) the line round the box (b) the gap round content (c) the gap to other boxes (d) space outside the border
- 14.Which of these is margin? (a) space outside the border (b) the line round the box (c) space inside the border (d) the text or picture
- 15.True or false: padding is space inside the border. (a) False (b) True
-
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: 15px;
border: 4px 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: 290px;
padding: 15px;
border: 2px solid black;
margin: 15px;
} -
18.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 50px;
padding: 25px;
border: 2px solid black;
margin: 20px;
} -
19.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 110px;
padding: 15px;
border: 3px solid black;
margin: 20px;
} -
20.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 120px;
padding: 15px;
border: 5px solid black;
margin: 5px;
} -
21.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 80px;
padding: 30px;
border: 1px solid black;
margin: 5px;
} - 22.Which of these is the border? (a) the text or picture (b) space outside the border (c) the gap round content (d) a solid or dotted edge
- 23.📦 In the box model, which part is the line round the box? (a) border (b) padding (c) content (d) margin
-
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: 110px;
padding: 5px;
border: 1px solid black;
margin: 0px;
} -
25.📦 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: 20px;
} - 26.True or false: the content is the text or picture. (a) True (b) False
- 27.True or false: the border is the gap to other boxes. (a) True (b) False
- 28.True or false: margin is the gap to other boxes. (a) False (b) True
- 29.True or false: margin is a solid or dotted edge. (a) False (b) True
-
30.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 230px;
padding: 20px;
border: 3px solid black;
margin: 0px;
} -
31.📦 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: 10px;
} -
32.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 50px;
padding: 10px;
border: 3px solid black;
margin: 5px;
} -
33.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 170px;
padding: 20px;
border: 2px solid black;
margin: 0px;
} -
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: 290px;
padding: 10px;
border: 1px solid black;
margin: 20px;
} - 35.Which of these is padding? (a) the gap to other boxes (b) the gap round content (c) the text or picture (d) space outside the border
-
36.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 210px;
padding: 15px;
border: 3px solid black;
margin: 10px;
} -
37.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 190px;
padding: 30px;
border: 1px solid black;
margin: 10px;
} -
38.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 180px;
padding: 30px;
border: 2px solid black;
margin: 20px;
} - 39.Which of these is margin? (a) the text or picture (b) the gap to other boxes (c) the line round the box (d) space inside the border
-
40.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 120px;
padding: 25px;
border: 3px solid black;
margin: 15px;
}
Answer key
- 168
- 302
- border
- 216
- 314
- padding
- 308
- False
- padding
- True
- margin
- False
- the line round the box
- space outside the border
- True
- 178
- 324
- 144
- 186
- 170
- 152
- a solid or dotted edge
- border
- 122
- 252
- True
- False
- True
- False
- 276
- 118
- 86
- 214
- 312
- the gap round content
- 266
- 272
- 284
- the gap to other boxes
- 206
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids