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: 50px;
padding: 25px;
border: 4px solid black;
margin: 15px;
} - 2.True or false: margin is space outside the border. (a) False (b) True
-
3.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 220px;
padding: 30px;
border: 1px solid black;
margin: 0px;
} -
4.📦 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: 5px solid black;
margin: 0px;
} -
5.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 90px;
padding: 10px;
border: 2px solid black;
margin: 15px;
} -
6.📦 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: 10px;
} - 7.Which of these is margin? (a) space inside the border (b) space outside the border (c) the gap round content (d) the text or picture
-
8.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 270px;
padding: 10px;
border: 1px solid black;
margin: 0px;
} - 9.📦 In the box model, which part is the text or picture? (a) margin (b) padding (c) border (d) content
-
10.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 180px;
padding: 5px;
border: 1px solid black;
margin: 0px;
} -
11.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 180px;
padding: 5px;
border: 4px solid black;
margin: 10px;
} -
12.📦 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: 10px;
border: 4px solid black;
margin: 15px;
} -
13.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 60px;
padding: 10px;
border: 1px solid black;
margin: 20px;
} - 14.📦 In the box model, which part is space inside the border? (a) content (b) padding (c) border (d) margin
- 15.📦 In the box model, which part is the gap to other boxes? (a) margin (b) content (c) padding (d) border
-
16.📦 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: 20px;
} -
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: 30px;
border: 1px solid black;
margin: 15px;
} -
18.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 280px;
padding: 5px;
border: 2px solid black;
margin: 10px;
} -
19.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 110px;
padding: 30px;
border: 3px solid black;
margin: 15px;
} -
20.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 40px;
padding: 5px;
border: 3px solid black;
margin: 5px;
} - 21.📦 In the box model, which part is a solid or dotted edge? (a) content (b) border (c) padding (d) margin
-
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: 170px;
padding: 20px;
border: 3px solid black;
margin: 5px;
} - 23.True or false: padding is the gap to other boxes. (a) True (b) False
- 24.True or false: padding is space inside the border. (a) False (b) True
-
25.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 140px;
padding: 20px;
border: 1px solid black;
margin: 0px;
} -
26.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 280px;
padding: 25px;
border: 1px solid black;
margin: 0px;
} - 27.Which of these is padding? (a) a solid or dotted edge (b) space inside the border (c) the text or picture (d) the gap to other boxes
-
28.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 200px;
padding: 15px;
border: 1px solid black;
margin: 0px;
} -
29.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 180px;
padding: 25px;
border: 4px solid black;
margin: 20px;
} - 30.Which of these is padding? (a) the text or picture (b) a solid or dotted edge (c) the gap round content (d) space outside the border
-
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: 230px;
padding: 10px;
border: 2px solid black;
margin: 0px;
} -
32.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 120px;
padding: 15px;
border: 1px solid black;
margin: 15px;
} - 33.Which of these is the content? (a) the gap to other boxes (b) the text or picture (c) space outside the border (d) space inside the border
-
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: 80px;
padding: 5px;
border: 5px solid black;
margin: 0px;
} -
35.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 130px;
padding: 25px;
border: 1px solid black;
margin: 20px;
} - 36.True or false: padding is a solid or dotted edge. (a) False (b) True
-
37.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 210px;
padding: 15px;
border: 5px solid black;
margin: 20px;
} -
38.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 200px;
padding: 15px;
border: 2px solid black;
margin: 0px;
} - 39.Which of these is the border? (a) the gap to other boxes (b) the line round the box (c) space inside the border (d) space outside the border
-
40.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 140px;
padding: 5px;
border: 3px solid black;
margin: 5px;
}
Answer key
- 138
- True
- 282
- 90
- 144
- 116
- space outside the border
- 292
- content
- 192
- 218
- 158
- 122
- padding
- margin
- 222
- 352
- 314
- 206
- 66
- border
- 216
- False
- True
- 182
- 332
- space inside the border
- 232
- 278
- the gap round content
- 254
- 152
- the text or picture
- 100
- 222
- False
- 290
- 234
- the line round the box
- 166
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids