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 the gap to other boxes? (a) border (b) content (c) margin (d) padding
- 2.Which of these is padding? (a) space inside the border (b) the text or picture (c) the line round the box (d) a solid or dotted edge
-
3.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 40px;
padding: 5px;
border: 1px solid black;
margin: 5px;
} - 4.📦 In the box model, which part is the line round the box? (a) padding (b) content (c) margin (d) border
- 5.📦 In the box model, which part is space inside the border? (a) border (b) margin (c) content (d) padding
-
6.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 270px;
padding: 15px;
border: 5px solid black;
margin: 5px;
} -
7.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 120px;
padding: 20px;
border: 1px solid black;
margin: 20px;
} -
8.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 50px;
padding: 30px;
border: 1px solid black;
margin: 15px;
} -
9.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 50px;
padding: 25px;
border: 1px solid black;
margin: 0px;
} -
10.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 240px;
padding: 25px;
border: 2px solid black;
margin: 20px;
} -
11.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 230px;
padding: 25px;
border: 2px solid black;
margin: 0px;
} - 12.True or false: the border is a solid or dotted edge. (a) False (b) True
- 13.Which of these is margin? (a) the text or picture (b) the gap to other boxes (c) a solid or dotted edge (d) the line round the box
-
14.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 190px;
padding: 20px;
border: 2px solid black;
margin: 20px;
} - 15.Which of these is the border? (a) a solid or dotted edge (b) the gap round content (c) space inside the border (d) space outside the border
-
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: 280px;
padding: 30px;
border: 1px solid black;
margin: 0px;
} -
17.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 130px;
padding: 25px;
border: 4px solid black;
margin: 15px;
} - 18.📦 In the box model, which part is space outside the border? (a) padding (b) content (c) margin (d) border
-
19.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 110px;
padding: 5px;
border: 3px solid black;
margin: 15px;
} -
20.📦 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: 5px;
border: 1px solid black;
margin: 0px;
} -
21.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 250px;
padding: 10px;
border: 1px solid black;
margin: 0px;
} - 22.True or false: the border is the gap to other boxes. (a) False (b) True
-
23.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 200px;
padding: 5px;
border: 1px solid black;
margin: 5px;
} - 24.True or false: margin is the line round the box. (a) False (b) True
-
25.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 100px;
padding: 10px;
border: 5px solid black;
margin: 5px;
} -
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: 25px;
border: 5px solid black;
margin: 20px;
} -
27.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 120px;
padding: 15px;
border: 1px solid black;
margin: 5px;
} -
28.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 160px;
padding: 30px;
border: 5px solid black;
margin: 20px;
} -
29.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 160px;
padding: 20px;
border: 1px solid black;
margin: 5px;
} -
30.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 110px;
padding: 30px;
border: 1px solid black;
margin: 20px;
} -
31.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 40px;
padding: 30px;
border: 3px solid black;
margin: 0px;
} - 32.Which of these is the content? (a) the line round the box (b) the gap to other boxes (c) the text or picture (d) space inside the border
-
33.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 120px;
padding: 20px;
border: 5px solid black;
margin: 20px;
} -
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: 200px;
padding: 10px;
border: 3px solid black;
margin: 5px;
} -
35.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 250px;
padding: 30px;
border: 2px solid black;
margin: 20px;
} - 36.True or false: padding is space outside the border. (a) False (b) True
-
37.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 150px;
padding: 10px;
border: 3px solid black;
margin: 5px;
} - 38.True or false: padding is a solid or dotted edge. (a) False (b) True
-
39.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 70px;
padding: 20px;
border: 1px solid black;
margin: 15px;
} -
40.📦 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: 4px solid black;
margin: 15px;
}
Answer key
- margin
- space inside the border
- 62
- border
- padding
- 320
- 202
- 142
- 102
- 334
- 284
- True
- the gap to other boxes
- 274
- a solid or dotted edge
- 342
- 218
- margin
- 126
- 192
- 272
- False
- 222
- False
- 130
- 360
- 162
- 270
- 212
- 212
- 106
- the text or picture
- 210
- 226
- 354
- False
- 186
- False
- 142
- 238
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids