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: 1px solid black;
margin: 5px;
} -
2.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 120px;
padding: 30px;
border: 2px solid black;
margin: 10px;
} -
3.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 100px;
padding: 30px;
border: 1px solid black;
margin: 15px;
} -
4.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 190px;
padding: 15px;
border: 3px solid black;
margin: 0px;
} - 5.Which of these is the content? (a) the text or picture (b) the line round the box (c) the gap round content (d) a solid or dotted edge
- 6.Which of these is the border? (a) the line round the box (b) the gap to other boxes (c) space inside the border (d) space outside the border
- 7.True or false: the border is the gap to other boxes. (a) True (b) False
-
8.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 250px;
padding: 15px;
border: 1px solid black;
margin: 10px;
} - 9.Which of these is margin? (a) the gap round content (b) the gap to other boxes (c) space inside the border (d) the line round the box
- 10.True or false: the border is a solid or dotted edge. (a) False (b) True
-
11.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 190px;
padding: 15px;
border: 2px solid black;
margin: 0px;
} - 12.True or false: margin is the gap to other boxes. (a) True (b) False
-
13.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 70px;
padding: 20px;
border: 1px solid black;
margin: 10px;
} -
14.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 280px;
padding: 5px;
border: 4px solid black;
margin: 20px;
} - 15.Which of these is margin? (a) space outside the border (b) space inside the border (c) the text or picture (d) the line round the box
- 16.📦 In the box model, which part is space outside the border? (a) padding (b) margin (c) content (d) border
-
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: 220px;
padding: 10px;
border: 1px solid black;
margin: 0px;
} -
18.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 80px;
padding: 5px;
border: 5px solid black;
margin: 10px;
} -
19.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 120px;
padding: 10px;
border: 3px solid black;
margin: 0px;
} -
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: 140px;
padding: 10px;
border: 2px solid black;
margin: 20px;
} -
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: 220px;
padding: 10px;
border: 4px solid black;
margin: 0px;
} - 22.True or false: the border is the line round the box. (a) False (b) True
-
23.📦 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: 10px;
border: 2px solid black;
margin: 20px;
} - 24.True or false: the content is the text or picture. (a) False (b) True
-
25.📦 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: 2px solid black;
margin: 5px;
} - 26.True or false: the content is a solid or dotted edge. (a) True (b) False
-
27.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 90px;
padding: 25px;
border: 2px solid black;
margin: 5px;
} -
28.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 120px;
padding: 25px;
border: 3px solid black;
margin: 0px;
} -
29.📦 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: 20px;
border: 4px solid black;
margin: 20px;
} - 30.True or false: the content is the gap to other boxes. (a) False (b) True
-
31.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 90px;
padding: 15px;
border: 4px solid black;
margin: 5px;
} -
32.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 210px;
padding: 5px;
border: 5px solid black;
margin: 10px;
} -
33.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 60px;
padding: 20px;
border: 2px solid black;
margin: 20px;
} -
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: 210px;
padding: 25px;
border: 3px solid black;
margin: 0px;
} - 35.📦 In the box model, which part is space inside the border? (a) border (b) padding (c) content (d) margin
-
36.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 120px;
padding: 5px;
border: 2px solid black;
margin: 15px;
} - 37.📦 In the box model, which part is the line round the box? (a) margin (b) padding (c) content (d) border
-
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: 160px;
padding: 15px;
border: 4px solid black;
margin: 0px;
} - 39.True or false: padding is the line round the box. (a) True (b) False
-
40.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 60px;
padding: 25px;
border: 5px solid black;
margin: 15px;
}
Answer key
- 112
- 204
- 192
- 226
- the text or picture
- the line round the box
- False
- 282
- the gap to other boxes
- True
- 224
- True
- 132
- 338
- space outside the border
- margin
- 242
- 120
- 146
- 164
- 248
- True
- 194
- True
- 174
- False
- 154
- 176
- 98
- False
- 138
- 250
- 144
- 266
- padding
- 164
- border
- 198
- False
- 150
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids