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: 160px;
padding: 5px;
border: 3px solid black;
margin: 15px;
} - 2.Which of these is padding? (a) space inside the border (b) the text or picture (c) a solid or dotted edge (d) the line round the box
- 3.True or false: padding is space outside the border. (a) False (b) True
- 4.Which of these is the border? (a) space inside the border (b) the gap to other boxes (c) a solid or dotted edge (d) the text or picture
- 5.📦 In the box model, which part is the text or picture? (a) border (b) padding (c) margin (d) content
- 6.📦 In the box model, which part is the gap to other boxes? (a) content (b) margin (c) padding (d) border
-
7.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 110px;
padding: 5px;
border: 1px solid black;
margin: 0px;
} -
8.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 90px;
padding: 10px;
border: 5px solid black;
margin: 0px;
} - 9.📦 In the box model, which part is the gap round content? (a) padding (b) content (c) margin (d) border
- 10.True or false: padding is the gap round content. (a) False (b) True
-
11.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 90px;
padding: 20px;
border: 5px solid black;
margin: 0px;
} -
12.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 150px;
padding: 5px;
border: 3px solid black;
margin: 20px;
} -
13.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 250px;
padding: 10px;
border: 1px solid black;
margin: 15px;
} -
14.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 80px;
padding: 30px;
border: 2px solid black;
margin: 0px;
} -
15.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 140px;
padding: 5px;
border: 3px solid black;
margin: 0px;
} - 16.True or false: margin is space outside the border. (a) False (b) True
-
17.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 140px;
padding: 20px;
border: 2px solid black;
margin: 15px;
} -
18.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 40px;
padding: 25px;
border: 5px solid black;
margin: 0px;
} - 19.True or false: margin is the text or picture. (a) True (b) False
-
20.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 220px;
padding: 20px;
border: 2px solid black;
margin: 20px;
} - 21.True or false: margin is the line round the box. (a) False (b) True
-
22.📦 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: 2px solid black;
margin: 15px;
} - 23.📦 In the box model, which part is space outside the border? (a) border (b) content (c) padding (d) margin
- 24.📦 In the box model, which part is a solid or dotted edge? (a) content (b) padding (c) border (d) margin
-
25.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 50px;
padding: 20px;
border: 5px solid black;
margin: 0px;
} - 26.Which of these is margin? (a) the gap to other boxes (b) the line round the box (c) the gap round content (d) space inside the border
-
27.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 130px;
padding: 10px;
border: 5px solid black;
margin: 15px;
} -
28.📦 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: 20px;
border: 2px solid black;
margin: 20px;
} -
29.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 140px;
padding: 20px;
border: 5px solid black;
margin: 0px;
} -
30.📦 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: 15px;
border: 4px solid black;
margin: 20px;
} - 31.📦 In the box model, which part is space inside the border? (a) margin (b) border (c) padding (d) content
-
32.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 270px;
padding: 15px;
border: 4px solid black;
margin: 5px;
} -
33.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 120px;
padding: 15px;
border: 2px solid black;
margin: 15px;
} -
34.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 50px;
padding: 10px;
border: 2px solid black;
margin: 0px;
} - 35.True or false: padding is the gap to other boxes. (a) True (b) False
- 36.True or false: padding is the text or picture. (a) False (b) True
- 37.Which of these is padding? (a) the text or picture (b) a solid or dotted edge (c) the gap round content (d) the line round the box
- 38.True or false: the content is the line round the box. (a) True (b) False
- 39.True or false: the border is a solid or dotted edge. (a) False (b) True
-
40.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 280px;
padding: 10px;
border: 1px solid black;
margin: 0px;
}
Answer key
- 176
- space inside the border
- False
- a solid or dotted edge
- content
- margin
- 122
- 120
- padding
- True
- 140
- 206
- 302
- 144
- 156
- True
- 214
- 100
- False
- 304
- False
- 214
- margin
- border
- 100
- the gap to other boxes
- 190
- 194
- 190
- 188
- padding
- 318
- 184
- 74
- False
- False
- the gap round content
- False
- True
- 302
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids