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.True or false: padding is the line round the box. (a) True (b) False
-
2.📦 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: 10px;
border: 5px solid black;
margin: 0px;
} -
3.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 100px;
padding: 5px;
border: 2px solid black;
margin: 0px;
} -
4.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 100px;
padding: 10px;
border: 1px solid black;
margin: 20px;
} -
5.📦 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: 5px;
border: 1px solid black;
margin: 10px;
} -
6.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 220px;
padding: 30px;
border: 5px solid black;
margin: 15px;
} - 7.Which of these is margin? (a) the line round the box (b) the text or picture (c) space inside the border (d) the gap to other boxes
-
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: 130px;
padding: 25px;
border: 3px solid black;
margin: 0px;
} -
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: 90px;
padding: 5px;
border: 4px solid black;
margin: 5px;
} - 10.📦 In the box model, which part is a solid or dotted edge? (a) content (b) padding (c) margin (d) border
- 11.Which of these is padding? (a) the text or picture (b) a solid or dotted edge (c) space inside the border (d) space outside the border
-
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: 210px;
padding: 30px;
border: 4px solid black;
margin: 5px;
} -
13.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 180px;
padding: 30px;
border: 4px solid black;
margin: 5px;
} -
14.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 210px;
padding: 25px;
border: 1px solid black;
margin: 10px;
} -
15.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 70px;
padding: 20px;
border: 2px solid black;
margin: 0px;
} - 16.Which of these is the content? (a) the text or picture (b) a solid or dotted edge (c) space inside the border (d) the gap round content
- 17.Which of these is the border? (a) the gap round content (b) the line round the box (c) space inside the border (d) the text or picture
-
18.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 250px;
padding: 5px;
border: 3px solid black;
margin: 15px;
} -
19.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 180px;
padding: 15px;
border: 5px solid black;
margin: 5px;
} -
20.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 90px;
padding: 20px;
border: 2px solid black;
margin: 0px;
} - 21.True or false: the border is the line round the box. (a) True (b) False
- 22.True or false: padding is the gap round content. (a) False (b) True
- 23.📦 In the box model, which part is the gap round content? (a) content (b) padding (c) margin (d) border
-
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: 150px;
padding: 25px;
border: 2px solid black;
margin: 5px;
} -
25.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 290px;
padding: 15px;
border: 3px solid black;
margin: 15px;
} - 26.📦 In the box model, which part is the gap to other boxes? (a) border (b) margin (c) content (d) padding
-
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: 50px;
padding: 15px;
border: 2px solid black;
margin: 0px;
} -
28.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 80px;
padding: 15px;
border: 1px solid black;
margin: 10px;
} -
29.📦 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: 5px;
} -
30.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 230px;
padding: 20px;
border: 1px solid black;
margin: 20px;
} -
31.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 130px;
padding: 25px;
border: 4px solid black;
margin: 0px;
} - 32.True or false: the content is a solid or dotted edge. (a) True (b) False
- 33.📦 In the box model, which part is space inside the border? (a) border (b) margin (c) padding (d) content
-
34.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 170px;
padding: 25px;
border: 2px solid black;
margin: 15px;
} -
35.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 40px;
padding: 5px;
border: 3px solid black;
margin: 5px;
} -
36.📦 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: 5px;
border: 2px solid black;
margin: 10px;
} -
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: 270px;
padding: 25px;
border: 5px solid black;
margin: 15px;
} -
38.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 80px;
padding: 15px;
border: 5px solid black;
margin: 5px;
} -
39.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 240px;
padding: 15px;
border: 1px solid black;
margin: 5px;
} -
40.📦 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;
}
Answer key
- False
- 190
- 114
- 162
- 92
- 290
- the gap to other boxes
- 186
- 108
- border
- space inside the border
- 278
- 258
- 282
- 114
- the text or picture
- the line round the box
- 296
- 230
- 134
- True
- True
- padding
- 204
- 356
- margin
- 84
- 132
- 190
- 312
- 188
- False
- padding
- 254
- 66
- 74
- 330
- 130
- 282
- 142
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids