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 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: 5px;
border: 1px solid black;
margin: 15px;
} -
2.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 180px;
padding: 5px;
border: 1px solid black;
margin: 0px;
} - 3.Which of these is padding? (a) the text or picture (b) the line round the box (c) the gap to other boxes (d) the gap round content
-
4.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 100px;
padding: 25px;
border: 5px solid black;
margin: 0px;
} -
5.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 40px;
padding: 10px;
border: 5px solid black;
margin: 10px;
} - 6.True or false: the border is a solid or dotted edge. (a) False (b) True
-
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: 290px;
padding: 10px;
border: 2px solid black;
margin: 20px;
} -
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: 80px;
padding: 20px;
border: 1px solid black;
margin: 5px;
} - 9.📦 In the box model, which part is the gap to other boxes? (a) margin (b) border (c) content (d) padding
- 10.📦 In the box model, which part is a solid or dotted edge? (a) padding (b) margin (c) content (d) border
- 11.Which of these is the border? (a) the gap to other boxes (b) space inside the border (c) the line round the box (d) the gap round content
-
12.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 90px;
padding: 20px;
border: 3px solid black;
margin: 5px;
} -
13.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 60px;
padding: 10px;
border: 4px solid black;
margin: 20px;
} -
14.📦 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: 4px solid black;
margin: 5px;
} - 15.True or false: padding is the line round the box. (a) False (b) True
-
16.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 80px;
padding: 5px;
border: 1px solid black;
margin: 5px;
} - 17.Which of these is the border? (a) the gap to other boxes (b) space inside the border (c) a solid or dotted edge (d) the gap round content
-
18.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 290px;
padding: 5px;
border: 2px solid black;
margin: 15px;
} - 19.True or false: the content is the text or picture. (a) True (b) False
-
20.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 140px;
padding: 10px;
border: 2px solid black;
margin: 5px;
} - 21.📦 In the box model, which part is the text or picture? (a) margin (b) border (c) padding (d) content
- 22.Which of these is margin? (a) a solid or dotted edge (b) the line round the box (c) the text or picture (d) space outside the border
- 23.📦 In the box model, which part is space outside the border? (a) border (b) content (c) margin (d) padding
-
24.📦 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: 10px;
border: 5px solid black;
margin: 5px;
} - 25.True or false: margin is the gap round content. (a) False (b) True
-
26.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 190px;
padding: 25px;
border: 3px solid black;
margin: 10px;
} -
27.📦 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: 1px solid black;
margin: 10px;
} -
28.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 80px;
padding: 20px;
border: 1px solid black;
margin: 10px;
} -
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: 300px;
padding: 10px;
border: 1px solid black;
margin: 0px;
} - 30.Which of these is margin? (a) space inside the border (b) the text or picture (c) the gap round content (d) the gap to other boxes
-
31.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 80px;
padding: 25px;
border: 2px solid black;
margin: 20px;
} - 32.True or false: the content is the line round the box. (a) False (b) True
- 33.True or false: the content is space outside the border. (a) True (b) False
- 34.📦 In the box model, which part is the gap round content? (a) margin (b) padding (c) content (d) border
-
35.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 170px;
padding: 15px;
border: 1px solid black;
margin: 0px;
} -
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: 300px;
padding: 5px;
border: 1px solid black;
margin: 5px;
} -
37.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 70px;
padding: 20px;
border: 2px solid black;
margin: 15px;
} - 38.Which of these is padding? (a) space outside the border (b) the line round the box (c) the gap to other boxes (d) space inside the border
- 39.True or false: the border is the text or picture. (a) True (b) False
-
40.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 280px;
padding: 5px;
border: 1px solid black;
margin: 0px;
}
Answer key
- 152
- 192
- the gap round content
- 160
- 90
- True
- 314
- 122
- margin
- border
- the line round the box
- 146
- 128
- 98
- False
- 102
- a solid or dotted edge
- 334
- True
- 174
- content
- space outside the border
- margin
- 90
- False
- 266
- 122
- 142
- 322
- the gap to other boxes
- 174
- False
- False
- padding
- 202
- 312
- 114
- space inside the border
- False
- 292
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids