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: 230px;
padding: 25px;
border: 2px solid black;
margin: 15px;
} -
2.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 170px;
padding: 10px;
border: 2px solid black;
margin: 5px;
} -
3.📦 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: 5px;
border: 4px solid black;
margin: 5px;
} -
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: 300px;
padding: 15px;
border: 1px solid black;
margin: 20px;
} -
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: 290px;
padding: 10px;
border: 5px solid black;
margin: 15px;
} -
6.📦 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: 5px solid black;
margin: 20px;
} - 7.📦 In the box model, which part is space inside the border? (a) content (b) border (c) padding (d) margin
-
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: 120px;
padding: 15px;
border: 2px solid black;
margin: 10px;
} - 9.📦 In the box model, which part is the gap round content? (a) margin (b) border (c) content (d) padding
- 10.Which of these is margin? (a) the line round the box (b) the gap to other boxes (c) the text or picture (d) space inside the border
- 11.True or false: the border is the gap round content. (a) True (b) False
-
12.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 190px;
padding: 20px;
border: 5px solid black;
margin: 20px;
} - 13.True or false: padding is space inside the border. (a) False (b) True
-
14.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 40px;
padding: 5px;
border: 3px solid black;
margin: 15px;
} - 15.📦 In the box model, which part is space outside the border? (a) border (b) padding (c) content (d) margin
-
16.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 90px;
padding: 5px;
border: 2px solid black;
margin: 15px;
} -
17.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 170px;
padding: 20px;
border: 4px solid black;
margin: 15px;
} - 18.Which of these is the border? (a) space outside the border (b) the gap round content (c) the text or picture (d) a solid or dotted edge
- 19.Which of these is padding? (a) space inside the border (b) the gap to other boxes (c) space outside the border (d) a solid or dotted edge
- 20.📦 In the box model, which part is the line round the box? (a) padding (b) margin (c) border (d) content
-
21.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 120px;
padding: 20px;
border: 5px solid black;
margin: 5px;
} - 22.True or false: margin is space inside the border. (a) False (b) True
- 23.Which of these is margin? (a) the gap round content (b) a solid or dotted edge (c) space outside the border (d) space inside the border
- 24.📦 In the box model, which part is a solid or dotted edge? (a) content (b) border (c) margin (d) padding
- 25.Which of these is padding? (a) the gap round content (b) the gap to other boxes (c) the text or picture (d) a solid or dotted edge
- 26.📦 In the box model, which part is the text or picture? (a) padding (b) margin (c) border (d) content
- 27.True or false: margin is space outside the border. (a) False (b) True
-
28.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 210px;
padding: 20px;
border: 4px solid black;
margin: 20px;
} -
29.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 140px;
padding: 20px;
border: 5px solid black;
margin: 20px;
} -
30.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 230px;
padding: 30px;
border: 3px solid black;
margin: 0px;
} -
31.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 70px;
padding: 15px;
border: 1px solid black;
margin: 0px;
} - 32.True or false: padding is a solid or dotted edge. (a) False (b) True
-
33.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 190px;
padding: 5px;
border: 5px solid black;
margin: 10px;
} -
34.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 50px;
padding: 10px;
border: 1px solid black;
margin: 0px;
} -
35.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 280px;
padding: 20px;
border: 2px solid black;
margin: 0px;
} - 36.True or false: padding is the text or picture. (a) True (b) False
- 37.True or false: the content is space outside the border. (a) True (b) False
- 38.Which of these is the border? (a) the gap to other boxes (b) space inside the border (c) the gap round content (d) the line round the box
-
39.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 130px;
padding: 20px;
border: 2px solid black;
margin: 5px;
} - 40.True or false: the border is the line round the box. (a) False (b) True
Answer key
- 314
- 204
- 268
- 332
- 320
- 330
- padding
- 154
- padding
- the gap to other boxes
- False
- 280
- True
- 86
- margin
- 134
- 248
- a solid or dotted edge
- space inside the border
- border
- 180
- False
- space outside the border
- border
- the gap round content
- content
- True
- 298
- 230
- 296
- 102
- False
- 230
- 72
- 324
- False
- False
- the line round the box
- 184
- True
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids