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 much space top to bottom (px) does this box take in all, margin included?
.box {
height: 160px;
padding: 5px;
border: 4px solid black;
margin: 5px;
} -
2.📦 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: 5px;
border: 3px solid black;
margin: 10px;
} - 3.Which of these is padding? (a) the gap to other boxes (b) the text or picture (c) space outside the border (d) space inside the border
- 4.📦 In the box model, which part is a solid or dotted edge? (a) padding (b) content (c) border (d) margin
-
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: 260px;
padding: 30px;
border: 4px solid black;
margin: 10px;
} - 6.Which of these is the border? (a) the text or picture (b) the gap round content (c) a solid or dotted edge (d) space outside the border
-
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: 160px;
padding: 15px;
border: 5px solid black;
margin: 0px;
} - 8.📦 In the box model, which part is the gap round content? (a) content (b) border (c) padding (d) margin
-
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: 60px;
padding: 5px;
border: 4px solid black;
margin: 0px;
} - 10.Which of these is padding? (a) space outside the border (b) the gap round content (c) the line round the box (d) the gap to other boxes
-
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: 60px;
padding: 25px;
border: 1px solid black;
margin: 0px;
} -
12.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 150px;
padding: 25px;
border: 4px solid black;
margin: 0px;
} -
13.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 120px;
padding: 20px;
border: 5px solid black;
margin: 0px;
} - 14.📦 In the box model, which part is the line round the box? (a) content (b) padding (c) margin (d) border
- 15.True or false: the content is the gap to other boxes. (a) True (b) False
-
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: 60px;
padding: 25px;
border: 2px solid black;
margin: 20px;
} - 17.📦 In the box model, which part is space inside the border? (a) margin (b) padding (c) border (d) content
- 18.True or false: margin is space inside the border. (a) False (b) True
-
19.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 90px;
padding: 10px;
border: 2px solid black;
margin: 10px;
} - 20.Which of these is the content? (a) space inside the border (b) space outside the border (c) the text or picture (d) the line round the box
- 21.True or false: margin is space outside the border. (a) False (b) True
- 22.📦 In the box model, which part is the gap to other boxes? (a) border (b) padding (c) content (d) margin
-
23.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 210px;
padding: 10px;
border: 1px solid black;
margin: 5px;
} -
24.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 180px;
padding: 30px;
border: 2px solid black;
margin: 5px;
} -
25.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 50px;
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: 250px;
padding: 25px;
border: 4px solid black;
margin: 0px;
} -
27.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 160px;
padding: 10px;
border: 3px solid black;
margin: 5px;
} -
28.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 120px;
padding: 15px;
border: 4px solid black;
margin: 10px;
} -
29.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 270px;
padding: 5px;
border: 3px 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: 120px;
padding: 10px;
border: 5px solid black;
margin: 0px;
} -
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: 180px;
padding: 20px;
border: 2px solid black;
margin: 0px;
} -
32.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 50px;
padding: 5px;
border: 1px solid black;
margin: 0px;
} -
33.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 160px;
padding: 5px;
border: 5px solid black;
margin: 0px;
} -
34.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 280px;
padding: 5px;
border: 2px solid black;
margin: 20px;
} -
35.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 120px;
padding: 5px;
border: 1px solid black;
margin: 0px;
} -
36.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 180px;
padding: 20px;
border: 4px solid black;
margin: 20px;
} - 37.📦 In the box model, which part is the text or picture? (a) padding (b) border (c) content (d) margin
-
38.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 130px;
padding: 25px;
border: 3px solid black;
margin: 5px;
} - 39.True or false: the border is the gap to other boxes. (a) True (b) False
-
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: 260px;
padding: 25px;
border: 5px solid black;
margin: 5px;
}
Answer key
- 188
- 166
- space inside the border
- border
- 328
- a solid or dotted edge
- 200
- padding
- 78
- the gap round content
- 112
- 208
- 170
- border
- False
- 114
- padding
- False
- 134
- the text or picture
- True
- margin
- 242
- 254
- 90
- 308
- 196
- 178
- 286
- 150
- 224
- 62
- 180
- 334
- 132
- 268
- content
- 196
- False
- 320
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids