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: 300px;
padding: 25px;
border: 1px solid black;
margin: 10px;
} - 2.True or false: the content is the text or picture. (a) True (b) False
-
3.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 60px;
padding: 15px;
border: 1px solid black;
margin: 0px;
} - 4.Which of these is padding? (a) space outside the border (b) the text or picture (c) the gap round content (d) a solid or dotted edge
-
5.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 100px;
padding: 25px;
border: 1px solid black;
margin: 0px;
} - 6.Which of these is margin? (a) the gap to other boxes (b) the text or picture (c) a solid or dotted edge (d) the gap round content
- 7.📦 In the box model, which part is the text or picture? (a) margin (b) border (c) padding (d) content
-
8.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 90px;
padding: 5px;
border: 5px solid black;
margin: 15px;
} - 9.True or false: the border is the gap round content. (a) False (b) True
-
10.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 110px;
padding: 25px;
border: 3px solid black;
margin: 20px;
} - 11.Which of these is the content? (a) space outside the border (b) space inside the border (c) the text or picture (d) the gap round content
- 12.📦 In the box model, which part is space inside the border? (a) margin (b) padding (c) content (d) border
- 13.📦 In the box model, which part is the gap to other boxes? (a) border (b) content (c) padding (d) margin
- 14.True or false: the border is space inside the border. (a) True (b) False
- 15.True or false: margin is space outside the border. (a) True (b) False
- 16.Which of these is the border? (a) the gap round content (b) space outside the border (c) the line round the box (d) space inside the border
- 17.📦 In the box model, which part is a solid or dotted edge? (a) content (b) padding (c) margin (d) border
- 18.True or false: padding is the gap round content. (a) False (b) True
- 19.True or false: margin is the text or picture. (a) True (b) False
-
20.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 130px;
padding: 20px;
border: 1px solid black;
margin: 10px;
} - 21.Which of these is margin? (a) space outside the border (b) the text or picture (c) the gap round content (d) the line round the box
- 22.Which of these is the border? (a) the text or picture (b) the gap round content (c) the gap to other boxes (d) a solid or dotted edge
-
23.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 190px;
padding: 5px;
border: 1px solid black;
margin: 0px;
} - 24.Which of these is padding? (a) space inside the border (b) the line round the box (c) space outside the border (d) a solid or dotted edge
- 25.📦 In the box model, which part is the line round the box? (a) content (b) border (c) margin (d) padding
-
26.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 100px;
padding: 25px;
border: 4px solid black;
margin: 15px;
} -
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: 210px;
padding: 25px;
border: 1px solid black;
margin: 0px;
} -
28.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 190px;
padding: 10px;
border: 3px solid black;
margin: 5px;
} -
29.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 160px;
padding: 25px;
border: 5px solid black;
margin: 10px;
} -
30.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 140px;
padding: 20px;
border: 2px solid black;
margin: 5px;
} -
31.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 50px;
padding: 20px;
border: 1px solid black;
margin: 10px;
} -
32.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 80px;
padding: 5px;
border: 1px solid black;
margin: 10px;
} -
33.📦 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: 10px;
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: 160px;
padding: 5px;
border: 3px solid black;
margin: 20px;
} - 35.True or false: padding is space inside the border. (a) False (b) True
- 36.True or false: the border is the line round the box. (a) False (b) True
- 37.📦 In the box model, which part is the gap round content? (a) border (b) margin (c) content (d) padding
- 38.📦 In the box model, which part is space outside the border? (a) border (b) padding (c) content (d) margin
-
39.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 80px;
padding: 5px;
border: 1px solid black;
margin: 15px;
} -
40.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 250px;
padding: 5px;
border: 3px solid black;
margin: 10px;
}
Answer key
- 372
- True
- 92
- the gap round content
- 152
- the gap to other boxes
- content
- 140
- False
- 206
- the text or picture
- padding
- margin
- False
- True
- the line round the box
- border
- True
- False
- 192
- space outside the border
- a solid or dotted edge
- 202
- space inside the border
- border
- 188
- 262
- 226
- 240
- 194
- 112
- 112
- 284
- 176
- True
- True
- padding
- margin
- 122
- 286
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids