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.📦 In the box model, which part is a solid or dotted edge? (a) margin (b) padding (c) border (d) content
-
2.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 300px;
padding: 5px;
border: 4px solid black;
margin: 5px;
} - 3.📦 In the box model, which part is space inside the border? (a) margin (b) border (c) content (d) padding
-
4.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 220px;
padding: 10px;
border: 3px solid black;
margin: 10px;
} -
5.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 250px;
padding: 5px;
border: 4px solid black;
margin: 5px;
} -
6.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 120px;
padding: 25px;
border: 2px solid black;
margin: 5px;
} - 7.True or false: the border is the line round the box. (a) True (b) False
-
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: 220px;
padding: 10px;
border: 1px solid black;
margin: 5px;
} -
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: 160px;
padding: 30px;
border: 3px solid black;
margin: 10px;
} -
10.📦 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;
} - 11.Which of these is the border? (a) the line round the box (b) space inside the border (c) the text or picture (d) the gap round content
- 12.True or false: margin is the text or picture. (a) True (b) False
-
13.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 230px;
padding: 15px;
border: 4px solid black;
margin: 20px;
} - 14.True or false: the border is a solid or dotted edge. (a) False (b) True
-
15.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 50px;
padding: 25px;
border: 4px solid black;
margin: 15px;
} -
16.📦 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: 25px;
border: 2px solid black;
margin: 5px;
} - 17.Which of these is the content? (a) space outside the border (b) a solid or dotted edge (c) the text or picture (d) space inside the border
-
18.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 80px;
padding: 20px;
border: 4px solid black;
margin: 20px;
} -
19.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 160px;
padding: 15px;
border: 5px solid black;
margin: 10px;
} - 20.True or false: the content is the text or picture. (a) False (b) True
- 21.Which of these is the border? (a) space inside the border (b) the text or picture (c) the gap to other boxes (d) a solid or dotted edge
-
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: 280px;
padding: 15px;
border: 1px solid black;
margin: 15px;
} -
23.📦 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: 20px;
border: 1px solid black;
margin: 10px;
} -
24.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 180px;
padding: 25px;
border: 5px solid black;
margin: 0px;
} - 25.📦 In the box model, which part is the gap to other boxes? (a) margin (b) padding (c) border (d) content
-
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: 250px;
padding: 10px;
border: 4px solid black;
margin: 20px;
} -
27.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 280px;
padding: 10px;
border: 5px solid black;
margin: 5px;
} -
28.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 80px;
padding: 30px;
border: 5px solid black;
margin: 0px;
} -
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: 150px;
padding: 25px;
border: 4px solid black;
margin: 5px;
} -
30.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 140px;
padding: 15px;
border: 4px solid black;
margin: 15px;
} -
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: 5px;
border: 2px solid black;
margin: 20px;
} - 32.Which of these is margin? (a) space inside the border (b) the gap to other boxes (c) the text or picture (d) a solid or dotted edge
- 33.Which of these is padding? (a) a solid or dotted edge (b) the gap to other boxes (c) the line round the box (d) the gap round content
-
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: 290px;
padding: 15px;
border: 3px solid black;
margin: 15px;
} -
35.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 110px;
padding: 25px;
border: 5px solid black;
margin: 0px;
} -
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: 260px;
padding: 15px;
border: 5px solid black;
margin: 15px;
} -
37.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 170px;
padding: 30px;
border: 2px solid black;
margin: 5px;
} -
38.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 110px;
padding: 10px;
border: 3px solid black;
margin: 15px;
} -
39.📦 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: 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: 100px;
padding: 25px;
border: 1px solid black;
margin: 0px;
}
Answer key
- border
- 328
- padding
- 266
- 278
- 184
- True
- 242
- 226
- 186
- the line round the box
- False
- 308
- True
- 138
- 354
- the text or picture
- 168
- 220
- True
- a solid or dotted edge
- 312
- 252
- 240
- margin
- 278
- 320
- 150
- 208
- 208
- 64
- the gap to other boxes
- the gap round content
- 326
- 170
- 300
- 244
- 166
- 262
- 152
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids