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: 130px;
padding: 10px;
border: 3px solid black;
margin: 15px;
} -
2.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 120px;
padding: 5px;
border: 4px solid black;
margin: 0px;
} -
3.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 180px;
padding: 15px;
border: 3px solid black;
margin: 20px;
} -
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: 60px;
padding: 15px;
border: 4px solid black;
margin: 0px;
} - 5.📦 In the box model, which part is the line round the box? (a) content (b) padding (c) border (d) margin
- 6.📦 In the box model, which part is the gap round content? (a) padding (b) border (c) margin (d) content
- 7.True or false: padding is space inside the border. (a) False (b) True
-
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: 200px;
padding: 25px;
border: 1px solid black;
margin: 20px;
} -
9.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 90px;
padding: 25px;
border: 2px solid black;
margin: 0px;
} - 10.True or false: padding is the line round the box. (a) False (b) True
- 11.📦 In the box model, which part is space outside the border? (a) content (b) padding (c) margin (d) border
-
12.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 180px;
padding: 10px;
border: 1px solid black;
margin: 5px;
} - 13.📦 In the box model, which part is the gap to other boxes? (a) padding (b) border (c) content (d) margin
- 14.📦 In the box model, which part is space inside the border? (a) content (b) border (c) margin (d) padding
- 15.Which of these is padding? (a) the text or picture (b) space outside the border (c) the line round the box (d) space inside the border
-
16.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 300px;
padding: 25px;
border: 2px solid black;
margin: 15px;
} -
17.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 260px;
padding: 10px;
border: 1px solid black;
margin: 20px;
} -
18.📦 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: 10px;
} - 19.Which of these is padding? (a) space outside the border (b) the gap round content (c) a solid or dotted edge (d) the gap to other boxes
- 20.True or false: margin is space inside the border. (a) True (b) False
- 21.True or false: padding is the text or picture. (a) True (b) False
- 22.Which of these is the border? (a) the text or picture (b) space inside the border (c) the gap round content (d) a solid or dotted edge
- 23.📦 In the box model, which part is the text or picture? (a) margin (b) border (c) padding (d) content
-
24.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 190px;
padding: 25px;
border: 4px solid black;
margin: 20px;
} - 25.True or false: the border is the line round the box. (a) True (b) False
-
26.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 200px;
padding: 30px;
border: 5px solid black;
margin: 10px;
} -
27.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 80px;
padding: 30px;
border: 1px solid black;
margin: 0px;
} - 28.Which of these is margin? (a) a solid or dotted edge (b) the line round the box (c) space inside the border (d) the gap to other boxes
-
29.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 200px;
padding: 25px;
border: 1px solid black;
margin: 5px;
} - 30.Which of these is margin? (a) the gap round content (b) space inside the border (c) the text or picture (d) space outside the border
-
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: 70px;
padding: 5px;
border: 1px solid black;
margin: 10px;
} -
32.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 60px;
padding: 15px;
border: 2px solid black;
margin: 20px;
} -
33.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 260px;
padding: 10px;
border: 4px solid black;
margin: 15px;
} - 34.True or false: the content is the line round the box. (a) True (b) False
- 35.True or false: the content is the text or picture. (a) True (b) False
-
36.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 80px;
padding: 5px;
border: 3px solid black;
margin: 15px;
} -
37.📦 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: 3px solid black;
margin: 0px;
} -
38.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 100px;
padding: 5px;
border: 4px solid black;
margin: 15px;
} - 39.True or false: margin is the gap round content. (a) True (b) False
-
40.📦 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: 5px;
border: 2px solid black;
margin: 5px;
}
Answer key
- 186
- 138
- 256
- 98
- border
- padding
- True
- 252
- 144
- False
- margin
- 212
- margin
- padding
- space inside the border
- 384
- 322
- 178
- the gap round content
- False
- False
- a solid or dotted edge
- content
- 288
- True
- 290
- 142
- the gap to other boxes
- 262
- space outside the border
- 82
- 134
- 318
- False
- True
- 126
- 196
- 148
- False
- 164
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids