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: 290px;
padding: 20px;
border: 4px solid black;
margin: 10px;
} -
2.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 140px;
padding: 25px;
border: 2px solid black;
margin: 5px;
} - 3.True or false: padding is the gap to other boxes. (a) True (b) False
- 4.Which of these is the content? (a) space inside the border (b) the gap to other boxes (c) the text or picture (d) the line round the box
-
5.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 140px;
padding: 30px;
border: 2px solid black;
margin: 5px;
} -
6.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 150px;
padding: 5px;
border: 1px solid black;
margin: 15px;
} -
7.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 50px;
padding: 30px;
border: 1px solid black;
margin: 15px;
} -
8.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 170px;
padding: 20px;
border: 4px solid black;
margin: 0px;
} -
9.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 190px;
padding: 15px;
border: 2px solid black;
margin: 0px;
} -
10.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 170px;
padding: 20px;
border: 4px solid black;
margin: 0px;
} -
11.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 70px;
padding: 25px;
border: 4px solid black;
margin: 5px;
} -
12.📦 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: 15px;
border: 5px solid black;
margin: 5px;
} -
13.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 80px;
padding: 10px;
border: 2px solid black;
margin: 15px;
} - 14.Which of these is margin? (a) the line round the box (b) a solid or dotted edge (c) space outside the border (d) the text or picture
-
15.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 70px;
padding: 5px;
border: 4px solid black;
margin: 10px;
} -
16.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 70px;
padding: 5px;
border: 1px solid black;
margin: 5px;
} - 17.📦 In the box model, which part is a solid or dotted edge? (a) content (b) margin (c) border (d) padding
-
18.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 120px;
padding: 5px;
border: 5px solid black;
margin: 20px;
} - 19.True or false: margin is the gap round content. (a) True (b) False
-
20.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 70px;
padding: 20px;
border: 4px solid black;
margin: 5px;
} - 21.True or false: the content is a solid or dotted edge. (a) True (b) False
-
22.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 160px;
padding: 15px;
border: 3px solid black;
margin: 10px;
} -
23.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 70px;
padding: 15px;
border: 2px solid black;
margin: 20px;
} - 24.True or false: padding is space inside the border. (a) True (b) False
- 25.True or false: margin is a solid or dotted edge. (a) False (b) True
-
26.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 300px;
padding: 10px;
border: 3px solid black;
margin: 5px;
} - 27.True or false: padding is the gap round content. (a) False (b) True
-
28.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 90px;
padding: 10px;
border: 4px solid black;
margin: 15px;
} - 29.True or false: the border is the text or picture. (a) False (b) True
- 30.Which of these is padding? (a) the gap round content (b) the gap to other boxes (c) space outside the border (d) the text or picture
-
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: 90px;
padding: 25px;
border: 1px solid black;
margin: 0px;
} - 32.📦 In the box model, which part is the text or picture? (a) border (b) margin (c) content (d) padding
-
33.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 220px;
padding: 5px;
border: 1px solid black;
margin: 20px;
} -
34.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 140px;
padding: 30px;
border: 4px solid black;
margin: 15px;
} - 35.True or false: margin is space outside the border. (a) False (b) True
- 36.📦 In the box model, which part is the gap to other boxes? (a) border (b) content (c) padding (d) margin
-
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: 210px;
padding: 10px;
border: 3px solid black;
margin: 5px;
} -
38.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 300px;
padding: 5px;
border: 5px solid black;
margin: 10px;
} -
39.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 240px;
padding: 15px;
border: 1px solid black;
margin: 15px;
} - 40.📦 In the box model, which part is space outside the border? (a) content (b) border (c) padding (d) margin
Answer key
- 358
- 204
- False
- the text or picture
- 214
- 192
- 142
- 218
- 224
- 218
- 138
- 310
- 134
- space outside the border
- 108
- 92
- border
- 180
- False
- 128
- False
- 216
- 144
- True
- False
- 326
- True
- 148
- False
- the gap round content
- 142
- content
- 272
- 238
- True
- margin
- 236
- 340
- 302
- margin
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids