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 across (px) does this box take in all, margin included?
.box {
width: 300px;
padding: 20px;
border: 4px solid black;
margin: 10px;
} -
2.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 60px;
padding: 30px;
border: 5px solid black;
margin: 20px;
} - 3.Which of these is the border? (a) space inside the border (b) the gap round content (c) the line round the box (d) the gap to other boxes
-
4.📦 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: 30px;
border: 5px solid black;
margin: 0px;
} -
5.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 60px;
padding: 10px;
border: 1px solid black;
margin: 10px;
} - 6.📦 In the box model, which part is the text or picture? (a) margin (b) border (c) content (d) padding
- 7.True or false: the content is a solid or dotted edge. (a) False (b) True
- 8.True or false: margin is space outside the border. (a) True (b) False
- 9.True or false: padding is the gap to other boxes. (a) True (b) False
-
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: 30px;
border: 3px solid black;
margin: 15px;
} - 11.Which of these is the border? (a) the gap round content (b) a solid or dotted edge (c) space outside the border (d) the text or picture
- 12.Which of these is margin? (a) the line round the box (b) the text or picture (c) space inside the border (d) space outside the border
- 13.Which of these is the content? (a) a solid or dotted edge (b) the line round the box (c) the text or picture (d) the gap to other boxes
- 14.True or false: the content is the text or picture. (a) True (b) False
-
15.📦 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: 30px;
border: 2px solid black;
margin: 5px;
} - 16.True or false: the border is a solid or dotted edge. (a) False (b) True
-
17.📦 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: 30px;
border: 5px solid black;
margin: 15px;
} -
18.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 150px;
padding: 25px;
border: 2px solid black;
margin: 10px;
} - 19.📦 In the box model, which part is the gap round content? (a) border (b) margin (c) content (d) padding
- 20.Which of these is padding? (a) the gap round content (b) space outside the border (c) the line round the box (d) a solid or dotted edge
-
21.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 300px;
padding: 20px;
border: 4px solid black;
margin: 0px;
} - 22.True or false: margin is the line round the box. (a) True (b) False
- 23.📦 In the box model, which part is the gap to other boxes? (a) content (b) border (c) padding (d) margin
-
24.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 270px;
padding: 30px;
border: 4px solid black;
margin: 20px;
} -
25.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 60px;
padding: 15px;
border: 1px solid black;
margin: 0px;
} - 26.True or false: margin is space inside the border. (a) False (b) True
-
27.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 40px;
padding: 10px;
border: 2px solid black;
margin: 10px;
} - 28.True or false: margin is the gap to other boxes. (a) True (b) False
-
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: 220px;
padding: 30px;
border: 1px solid black;
margin: 15px;
} -
30.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 150px;
padding: 20px;
border: 5px solid black;
margin: 0px;
} -
31.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 130px;
padding: 15px;
border: 3px solid black;
margin: 0px;
} -
32.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 90px;
padding: 15px;
border: 5px solid black;
margin: 10px;
} - 33.True or false: padding is the gap round content. (a) True (b) False
-
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: 220px;
padding: 20px;
border: 1px solid black;
margin: 20px;
} -
35.📦 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: 1px solid black;
margin: 20px;
} -
36.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 110px;
padding: 10px;
border: 3px solid black;
margin: 5px;
} -
37.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 130px;
padding: 25px;
border: 5px solid black;
margin: 5px;
} -
38.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 90px;
padding: 15px;
border: 3px solid black;
margin: 0px;
} -
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: 110px;
padding: 30px;
border: 4px solid black;
margin: 5px;
} -
40.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 210px;
padding: 15px;
border: 5px solid black;
margin: 5px;
}
Answer key
- 368
- 170
- the line round the box
- 130
- 102
- content
- False
- True
- False
- 196
- a solid or dotted edge
- space outside the border
- the text or picture
- True
- 194
- True
- 170
- 224
- padding
- the gap round content
- 348
- False
- margin
- 378
- 92
- False
- 84
- True
- 282
- 200
- 166
- 150
- True
- 262
- 352
- 146
- 200
- 126
- 178
- 260
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids