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 across (px) does this box take in all, margin included?
.box {
width: 180px;
padding: 25px;
border: 4px solid black;
margin: 5px;
} - 2.Which of these is the content? (a) the text or picture (b) a solid or dotted edge (c) the gap to other boxes (d) the line round the box
-
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: 150px;
padding: 25px;
border: 5px solid black;
margin: 10px;
} -
4.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 90px;
padding: 5px;
border: 4px solid black;
margin: 15px;
} - 5.📦 In the box model, which part is the gap round content? (a) margin (b) border (c) content (d) padding
- 6.📦 In the box model, which part is space inside the border? (a) border (b) content (c) padding (d) margin
- 7.True or false: margin is the gap round content. (a) True (b) False
-
8.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 200px;
padding: 5px;
border: 5px solid black;
margin: 15px;
} - 9.True or false: padding is space inside the border. (a) True (b) False
- 10.📦 In the box model, which part is the text or picture? (a) margin (b) border (c) padding (d) content
- 11.True or false: margin is space outside the border. (a) False (b) True
- 12.Which of these is the border? (a) the gap to other boxes (b) space outside the border (c) space inside the border (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: 120px;
padding: 30px;
border: 5px solid black;
margin: 10px;
} - 14.True or false: padding is the text or picture. (a) True (b) False
-
15.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 270px;
padding: 10px;
border: 3px solid black;
margin: 0px;
} - 16.True or false: the border is space inside the border. (a) True (b) False
-
17.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 300px;
padding: 5px;
border: 4px solid black;
margin: 0px;
} - 18.📦 In the box model, which part is space outside the border? (a) padding (b) margin (c) border (d) content
-
19.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 80px;
padding: 20px;
border: 2px solid black;
margin: 15px;
} - 20.Which of these is padding? (a) a solid or dotted edge (b) the gap round content (c) the line round the box (d) space outside the border
-
21.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 210px;
padding: 25px;
border: 2px solid black;
margin: 0px;
} -
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: 270px;
padding: 10px;
border: 1px solid black;
margin: 5px;
} - 23.True or false: padding is the gap round content. (a) True (b) False
-
24.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 210px;
padding: 10px;
border: 3px solid black;
margin: 20px;
} -
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: 220px;
padding: 15px;
border: 2px solid black;
margin: 0px;
} -
26.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 180px;
padding: 5px;
border: 5px solid black;
margin: 15px;
} -
27.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 100px;
padding: 20px;
border: 3px solid black;
margin: 10px;
} -
28.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 40px;
padding: 10px;
border: 3px solid black;
margin: 5px;
} - 29.Which of these is margin? (a) the gap to other boxes (b) space inside the border (c) the line round the box (d) the gap round content
-
30.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 230px;
padding: 5px;
border: 1px solid black;
margin: 5px;
} - 31.True or false: the border is the line round the box. (a) True (b) False
-
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: 160px;
padding: 10px;
border: 5px solid black;
margin: 20px;
} -
33.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 230px;
padding: 20px;
border: 2px solid black;
margin: 10px;
} -
34.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 60px;
padding: 15px;
border: 4px solid black;
margin: 0px;
} -
35.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 140px;
padding: 10px;
border: 4px solid black;
margin: 15px;
} - 36.True or false: the border is a solid or dotted edge. (a) True (b) False
- 37.Which of these is padding? (a) the line round the box (b) space inside the border (c) the gap to other boxes (d) space outside the border
-
38.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 160px;
padding: 25px;
border: 2px solid black;
margin: 0px;
} -
39.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 100px;
padding: 15px;
border: 5px solid black;
margin: 15px;
} -
40.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 180px;
padding: 25px;
border: 4px solid black;
margin: 15px;
}
Answer key
- 248
- the text or picture
- 210
- 138
- padding
- padding
- False
- 250
- True
- content
- True
- a solid or dotted edge
- 190
- False
- 296
- False
- 318
- margin
- 154
- the gap round content
- 264
- 292
- True
- 276
- 254
- 230
- 166
- 76
- the gap to other boxes
- 252
- True
- 190
- 294
- 98
- 198
- True
- space inside the border
- 214
- 170
- 268
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids