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: 5px;
border: 4px solid black;
margin: 0px;
} -
2.📦 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: 5px solid black;
margin: 5px;
} - 3.Which of these is the content? (a) the text or picture (b) the line round the box (c) a solid or dotted edge (d) space inside the border
-
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: 120px;
padding: 15px;
border: 1px solid black;
margin: 10px;
} - 5.📦 In the box model, which part is the gap to other boxes? (a) padding (b) margin (c) border (d) content
-
6.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 50px;
padding: 15px;
border: 3px solid black;
margin: 20px;
} -
7.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 40px;
padding: 15px;
border: 2px solid black;
margin: 0px;
} - 8.Which of these is margin? (a) the gap round content (b) space outside the border (c) space inside the border (d) a solid or dotted edge
-
9.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 90px;
padding: 25px;
border: 1px solid black;
margin: 15px;
} -
10.📦 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: 20px;
border: 3px solid black;
margin: 20px;
} -
11.📦 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: 5px;
border: 3px solid black;
margin: 15px;
} - 12.True or false: margin is space outside the border. (a) False (b) True
- 13.True or false: the border is the text or picture. (a) False (b) True
- 14.Which of these is padding? (a) the text or picture (b) space outside the border (c) the gap round content (d) the gap to other boxes
-
15.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 180px;
padding: 20px;
border: 4px solid black;
margin: 5px;
} - 16.Which of these is padding? (a) the gap to other boxes (b) space inside the border (c) a solid or dotted edge (d) the text or picture
-
17.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 120px;
padding: 25px;
border: 1px solid black;
margin: 20px;
} - 18.📦 In the box model, which part is space outside the border? (a) content (b) padding (c) margin (d) border
- 19.📦 In the box model, which part is the text or picture? (a) border (b) padding (c) content (d) margin
-
20.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 130px;
padding: 20px;
border: 4px solid black;
margin: 20px;
} -
21.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 210px;
padding: 10px;
border: 5px solid black;
margin: 0px;
} - 22.📦 In the box model, which part is a solid or dotted edge? (a) margin (b) content (c) border (d) padding
-
23.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 250px;
padding: 15px;
border: 2px solid black;
margin: 0px;
} -
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: 90px;
padding: 25px;
border: 2px solid black;
margin: 10px;
} -
25.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 290px;
padding: 10px;
border: 1px solid black;
margin: 20px;
} - 26.📦 In the box model, which part is space inside the border? (a) margin (b) content (c) padding (d) border
-
27.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 100px;
padding: 15px;
border: 5px solid black;
margin: 20px;
} - 28.True or false: the content is the gap to other boxes. (a) True (b) False
-
29.📦 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: 15px;
} -
30.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 160px;
padding: 10px;
border: 4px solid black;
margin: 15px;
} -
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: 80px;
padding: 15px;
border: 2px solid black;
margin: 5px;
} - 32.True or false: padding is the gap to other boxes. (a) False (b) True
-
33.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 80px;
padding: 10px;
border: 2px solid black;
margin: 10px;
} - 34.True or false: margin is the gap round content. (a) True (b) False
-
35.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 60px;
padding: 10px;
border: 5px solid black;
margin: 5px;
} -
36.📦 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: 20px;
border: 1px solid black;
margin: 10px;
} - 37.📦 In the box model, which part is the gap round content? (a) border (b) content (c) margin (d) padding
-
38.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 130px;
padding: 25px;
border: 5px solid black;
margin: 5px;
} - 39.Which of these is the border? (a) the gap round content (b) a solid or dotted edge (c) space outside the border (d) space inside the border
-
40.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 140px;
padding: 25px;
border: 3px solid black;
margin: 15px;
}
Answer key
- 198
- 100
- the text or picture
- 152
- margin
- 126
- 74
- space outside the border
- 172
- 206
- 226
- True
- False
- the gap round content
- 238
- space inside the border
- 212
- margin
- content
- 218
- 240
- border
- 284
- 144
- 352
- padding
- 140
- False
- 86
- 218
- 114
- False
- 124
- False
- 100
- 312
- padding
- 200
- a solid or dotted edge
- 226
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids