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.Which of these is the content? (a) the line round the box (b) space inside the border (c) the gap to other boxes (d) the text or picture
- 2.📦 In the box model, which part is the line round the box? (a) content (b) margin (c) border (d) padding
- 3.📦 In the box model, which part is space inside the border? (a) border (b) content (c) padding (d) margin
-
4.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 140px;
padding: 25px;
border: 1px solid black;
margin: 20px;
} - 5.Which of these is the border? (a) the gap round content (b) space inside the border (c) space outside the border (d) the line round the box
- 6.Which of these is the border? (a) the gap round content (b) space inside the border (c) a solid or dotted edge (d) the gap to other boxes
-
7.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 120px;
padding: 20px;
border: 3px solid black;
margin: 0px;
} - 8.True or false: margin is space outside the border. (a) True (b) False
- 9.Which of these is padding? (a) the text or picture (b) the line round the box (c) the gap to other boxes (d) space inside the border
-
10.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 280px;
padding: 10px;
border: 5px solid black;
margin: 15px;
} - 11.Which of these is padding? (a) the line round the box (b) space outside the border (c) the gap round content (d) the text or picture
- 12.True or false: the border is the gap round content. (a) True (b) False
-
13.📦 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: 20px;
border: 4px solid black;
margin: 10px;
} -
14.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 70px;
padding: 30px;
border: 5px solid black;
margin: 0px;
} -
15.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 200px;
padding: 25px;
border: 1px solid black;
margin: 10px;
} - 16.True or false: padding is the line round the box. (a) True (b) False
- 17.📦 In the box model, which part is the text or picture? (a) border (b) margin (c) content (d) padding
-
18.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 170px;
padding: 30px;
border: 3px solid black;
margin: 20px;
} -
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: 140px;
padding: 10px;
border: 1px solid black;
margin: 15px;
} -
20.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 180px;
padding: 30px;
border: 1px solid black;
margin: 20px;
} - 21.📦 In the box model, which part is space outside the border? (a) content (b) margin (c) border (d) padding
-
22.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 90px;
padding: 20px;
border: 2px solid black;
margin: 20px;
} - 23.True or false: padding is the gap round content. (a) False (b) True
-
24.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 110px;
padding: 25px;
border: 4px solid black;
margin: 0px;
} -
25.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 90px;
padding: 25px;
border: 2px 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: 80px;
padding: 5px;
border: 1px solid black;
margin: 0px;
} -
27.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 110px;
padding: 10px;
border: 2px solid black;
margin: 10px;
} -
28.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 250px;
padding: 30px;
border: 2px solid black;
margin: 20px;
} - 29.📦 In the box model, which part is the gap to other boxes? (a) padding (b) margin (c) content (d) border
-
30.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 240px;
padding: 25px;
border: 5px solid black;
margin: 5px;
} - 31.📦 In the box model, which part is a solid or dotted edge? (a) border (b) margin (c) content (d) padding
-
32.📦 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: 20px;
border: 5px solid black;
margin: 15px;
} -
33.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 40px;
padding: 25px;
border: 1px solid black;
margin: 5px;
} - 34.Which of these is margin? (a) the gap round content (b) the gap to other boxes (c) the text or picture (d) space inside the border
-
35.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 50px;
padding: 25px;
border: 2px solid black;
margin: 20px;
} -
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: 190px;
padding: 10px;
border: 1px solid black;
margin: 5px;
} - 37.True or false: the border is the text or picture. (a) True (b) False
-
38.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 50px;
padding: 25px;
border: 1px solid black;
margin: 20px;
} -
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: 240px;
padding: 30px;
border: 2px solid black;
margin: 10px;
} -
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: 120px;
padding: 30px;
border: 5px solid black;
margin: 0px;
}
Answer key
- the text or picture
- border
- padding
- 232
- the line round the box
- a solid or dotted edge
- 166
- True
- space inside the border
- 340
- the gap round content
- False
- 208
- 140
- 272
- False
- content
- 236
- 162
- 282
- margin
- 174
- True
- 168
- 154
- 92
- 154
- 354
- margin
- 310
- border
- 330
- 102
- the gap to other boxes
- 144
- 212
- False
- 142
- 304
- 190
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids