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 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: 10px;
border: 4px solid black;
margin: 20px;
} - 2.📦 In the box model, which part is space inside the border? (a) padding (b) border (c) content (d) margin
-
3.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 170px;
padding: 15px;
border: 3px solid black;
margin: 20px;
} -
4.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 290px;
padding: 10px;
border: 5px solid black;
margin: 10px;
} - 5.Which of these is padding? (a) the line round the box (b) space outside the border (c) the gap round content (d) the text or picture
-
6.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 110px;
padding: 10px;
border: 1px solid black;
margin: 10px;
} - 7.Which of these is the content? (a) the gap round content (b) the text or picture (c) space outside the border (d) space inside the border
- 8.True or false: the border is a solid or dotted edge. (a) False (b) True
- 9.Which of these is the border? (a) the line round the box (b) the text or picture (c) space inside the border (d) space outside the border
-
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: 200px;
padding: 20px;
border: 4px solid black;
margin: 20px;
} - 11.True or false: padding is the text or picture. (a) True (b) False
-
12.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 110px;
padding: 30px;
border: 5px solid black;
margin: 10px;
} - 13.Which of these is margin? (a) space inside the border (b) a solid or dotted edge (c) the text or picture (d) space outside the border
- 14.Which of these is padding? (a) the gap to other boxes (b) space inside the border (c) the text or picture (d) the line round the box
-
15.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 90px;
padding: 20px;
border: 1px solid black;
margin: 5px;
} -
16.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 60px;
padding: 5px;
border: 4px solid black;
margin: 5px;
} - 17.True or false: the border is the gap to other boxes. (a) True (b) False
-
18.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 130px;
padding: 25px;
border: 3px solid black;
margin: 5px;
} -
19.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 50px;
padding: 5px;
border: 5px solid black;
margin: 10px;
} -
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: 280px;
padding: 30px;
border: 4px solid black;
margin: 0px;
} - 21.True or false: padding is the gap round content. (a) True (b) False
- 22.True or false: margin is a solid or dotted edge. (a) True (b) False
- 23.Which of these is margin? (a) the text or picture (b) the gap to other boxes (c) space inside the border (d) the line round the box
-
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: 170px;
padding: 25px;
border: 1px solid black;
margin: 20px;
} -
25.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 110px;
padding: 25px;
border: 2px solid black;
margin: 5px;
} -
26.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 130px;
padding: 15px;
border: 3px solid black;
margin: 0px;
} -
27.📦 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: 0px;
} - 28.True or false: padding is a solid or dotted edge. (a) True (b) False
- 29.📦 In the box model, which part is the line round the box? (a) content (b) margin (c) border (d) padding
- 30.📦 In the box model, which part is the gap round content? (a) content (b) border (c) padding (d) margin
-
31.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 230px;
padding: 10px;
border: 5px solid black;
margin: 10px;
} -
32.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 230px;
padding: 5px;
border: 3px solid black;
margin: 10px;
} -
33.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 150px;
padding: 30px;
border: 4px solid black;
margin: 10px;
} - 34.True or false: margin is the gap round content. (a) False (b) True
- 35.Which of these is the border? (a) a solid or dotted edge (b) the text or picture (c) space inside the border (d) space outside the border
- 36.True or false: margin is space inside the border. (a) False (b) True
- 37.📦 In the box model, which part is a solid or dotted edge? (a) margin (b) border (c) content (d) padding
- 38.True or false: the border is the line round the box. (a) True (b) False
-
39.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 200px;
padding: 10px;
border: 3px solid black;
margin: 5px;
} -
40.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 190px;
padding: 25px;
border: 3px solid black;
margin: 0px;
}
Answer key
- 178
- padding
- 246
- 340
- the gap round content
- 152
- the text or picture
- True
- the line round the box
- 248
- False
- 200
- space outside the border
- space inside the border
- 142
- 88
- False
- 196
- 90
- 348
- True
- False
- the gap to other boxes
- 222
- 174
- 166
- 66
- False
- border
- padding
- 280
- 266
- 238
- False
- a solid or dotted edge
- False
- border
- True
- 236
- 246
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids