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: 270px;
padding: 20px;
border: 5px solid black;
margin: 0px;
} - 2.📦 In the box model, which part is the gap round content? (a) padding (b) margin (c) content (d) border
- 3.📦 In the box model, which part is space inside the border? (a) border (b) content (c) margin (d) padding
-
4.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 150px;
padding: 15px;
border: 1px solid black;
margin: 15px;
} -
5.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 190px;
padding: 10px;
border: 5px solid black;
margin: 15px;
} - 6.Which of these is padding? (a) the gap round content (b) the gap to other boxes (c) the text or picture (d) space outside the border
- 7.Which of these is margin? (a) a solid or dotted edge (b) the gap round content (c) space inside the border (d) space outside the border
- 8.Which of these is the content? (a) the text or picture (b) a solid or dotted edge (c) the gap round content (d) space inside the border
-
9.📦 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: 4px solid black;
margin: 20px;
} - 10.📦 In the box model, which part is the text or picture? (a) border (b) margin (c) padding (d) content
- 11.True or false: margin is a solid or dotted edge. (a) True (b) False
- 12.Which of these is padding? (a) the gap to other boxes (b) space outside the border (c) a solid or dotted edge (d) space inside the border
-
13.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 90px;
padding: 15px;
border: 1px solid black;
margin: 10px;
} - 14.Which of these is the border? (a) the gap to other boxes (b) the text or picture (c) space outside the border (d) the line round the box
-
15.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 180px;
padding: 10px;
border: 4px solid black;
margin: 20px;
} - 16.True or false: padding is space outside the border. (a) False (b) True
-
17.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 90px;
padding: 25px;
border: 5px solid black;
margin: 0px;
} - 18.True or false: the content is space outside the border. (a) True (b) False
-
19.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 130px;
padding: 25px;
border: 5px solid black;
margin: 20px;
} -
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: 270px;
padding: 20px;
border: 4px solid black;
margin: 10px;
} - 21.True or false: the border is space inside the border. (a) True (b) False
-
22.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 270px;
padding: 15px;
border: 4px solid black;
margin: 15px;
} - 23.📦 In the box model, which part is space outside the border? (a) padding (b) border (c) margin (d) content
-
24.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 190px;
padding: 5px;
border: 1px solid black;
margin: 5px;
} - 25.📦 In the box model, which part is the gap to other boxes? (a) margin (b) border (c) padding (d) content
- 26.True or false: padding is the line round the box. (a) False (b) True
-
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: 60px;
padding: 20px;
border: 2px solid black;
margin: 15px;
} -
28.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 160px;
padding: 25px;
border: 4px solid black;
margin: 20px;
} -
29.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 290px;
padding: 20px;
border: 1px solid black;
margin: 0px;
} -
30.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 90px;
padding: 30px;
border: 1px solid black;
margin: 10px;
} -
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: 50px;
padding: 30px;
border: 2px solid black;
margin: 10px;
} -
32.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 180px;
padding: 10px;
border: 4px solid black;
margin: 5px;
} -
33.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 150px;
padding: 25px;
border: 5px 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: 180px;
padding: 15px;
border: 3px solid black;
margin: 0px;
} - 35.True or false: margin is space outside the border. (a) True (b) False
- 36.True or false: margin is the gap to other boxes. (a) True (b) False
- 37.True or false: the content is the gap to other boxes. (a) False (b) True
- 38.True or false: the content is the text or picture. (a) True (b) False
-
39.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 250px;
padding: 10px;
border: 4px solid black;
margin: 15px;
} -
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: 180px;
padding: 5px;
border: 1px solid black;
margin: 10px;
}
Answer key
- 320
- padding
- padding
- 212
- 250
- the gap round content
- space outside the border
- the text or picture
- 118
- content
- False
- space inside the border
- 142
- the line round the box
- 248
- False
- 150
- False
- 190
- 318
- False
- 338
- margin
- 212
- margin
- False
- 104
- 258
- 332
- 172
- 114
- 218
- 210
- 216
- True
- True
- False
- True
- 308
- 192
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids