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 a solid or dotted edge. (a) True (b) False
- 2.📦 In the box model, which part is the gap to other boxes? (a) content (b) border (c) margin (d) padding
-
3.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 170px;
padding: 15px;
border: 5px solid black;
margin: 10px;
} - 4.True or false: margin is space inside the border. (a) True (b) False
-
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: 230px;
padding: 5px;
border: 4px solid black;
margin: 5px;
} - 6.Which of these is the content? (a) space inside the border (b) the text or picture (c) the gap round content (d) space outside the border
- 7.Which of these is margin? (a) space inside the border (b) a solid or dotted edge (c) the gap to other boxes (d) the gap round content
-
8.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 170px;
padding: 20px;
border: 1px solid black;
margin: 15px;
} -
9.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 130px;
padding: 30px;
border: 4px solid black;
margin: 5px;
} -
10.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 170px;
padding: 10px;
border: 2px solid black;
margin: 10px;
} -
11.📦 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: 10px;
border: 4px solid black;
margin: 15px;
} -
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: 290px;
padding: 25px;
border: 5px solid black;
margin: 5px;
} - 13.True or false: margin is the gap to other boxes. (a) False (b) True
- 14.📦 In the box model, which part is the gap round content? (a) border (b) padding (c) margin (d) content
- 15.True or false: padding is space outside the border. (a) True (b) False
-
16.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 100px;
padding: 15px;
border: 1px solid black;
margin: 20px;
} - 17.True or false: the border is a solid or dotted edge. (a) False (b) True
- 18.📦 In the box model, which part is space outside the border? (a) content (b) margin (c) padding (d) border
-
19.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 60px;
padding: 5px;
border: 4px solid black;
margin: 15px;
} - 20.📦 In the box model, which part is space inside the border? (a) padding (b) content (c) margin (d) border
-
21.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 230px;
padding: 10px;
border: 3px solid black;
margin: 10px;
} -
22.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 300px;
padding: 15px;
border: 3px solid black;
margin: 5px;
} - 23.📦 In the box model, which part is the text or picture? (a) padding (b) margin (c) border (d) content
-
24.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 290px;
padding: 20px;
border: 3px solid black;
margin: 20px;
} - 25.True or false: the border is the gap round content. (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: 60px;
padding: 10px;
border: 2px solid black;
margin: 20px;
} -
27.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 50px;
padding: 15px;
border: 5px solid black;
margin: 20px;
} -
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: 90px;
padding: 15px;
border: 5px solid black;
margin: 20px;
} -
29.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 290px;
padding: 10px;
border: 5px solid black;
margin: 10px;
} - 30.📦 In the box model, which part is a solid or dotted edge? (a) border (b) content (c) padding (d) margin
-
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: 240px;
padding: 10px;
border: 1px solid black;
margin: 20px;
} - 32.Which of these is the border? (a) the gap to other boxes (b) space outside the border (c) the gap round content (d) the line round the box
- 33.True or false: the content is the text or picture. (a) True (b) False
- 34.True or false: padding is the line round the box. (a) False (b) True
-
35.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 120px;
padding: 30px;
border: 5px solid black;
margin: 5px;
} -
36.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 80px;
padding: 15px;
border: 4px solid black;
margin: 20px;
} -
37.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 40px;
padding: 25px;
border: 2px solid black;
margin: 20px;
} -
38.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 120px;
padding: 10px;
border: 1px solid black;
margin: 10px;
} -
39.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 160px;
padding: 25px;
border: 2px solid black;
margin: 0px;
} -
40.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 180px;
padding: 5px;
border: 3px solid black;
margin: 15px;
}
Answer key
- False
- margin
- 230
- False
- 248
- the text or picture
- the gap to other boxes
- 242
- 208
- 214
- 108
- 350
- True
- padding
- False
- 172
- True
- margin
- 108
- padding
- 276
- 346
- content
- 376
- False
- 84
- 130
- 130
- 340
- border
- 262
- the line round the box
- True
- False
- 200
- 158
- 134
- 162
- 214
- 226
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids