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: 170px;
padding: 5px;
border: 1px solid black;
margin: 15px;
} - 2.True or false: margin is a solid or dotted edge. (a) False (b) True
-
3.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 80px;
padding: 15px;
border: 5px solid black;
margin: 0px;
} - 4.True or false: the border is the line round the box. (a) True (b) False
-
5.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 200px;
padding: 25px;
border: 2px solid black;
margin: 5px;
} - 6.📦 In the box model, which part is the gap round content? (a) content (b) padding (c) border (d) margin
- 7.Which of these is the border? (a) space outside the border (b) the line round the box (c) the gap to other boxes (d) the gap round content
- 8.Which of these is the content? (a) space outside the border (b) the text or picture (c) the line round the box (d) the gap to other boxes
- 9.📦 In the box model, which part is space outside the border? (a) margin (b) padding (c) border (d) content
-
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: 160px;
padding: 25px;
border: 5px solid black;
margin: 15px;
} - 11.True or false: the border is space outside the border. (a) True (b) False
-
12.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 250px;
padding: 30px;
border: 5px solid black;
margin: 15px;
} - 13.True or false: padding is the text or picture. (a) True (b) False
-
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: 240px;
padding: 15px;
border: 1px solid black;
margin: 15px;
} -
15.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 160px;
padding: 5px;
border: 1px solid black;
margin: 20px;
} - 16.Which of these is margin? (a) space inside the border (b) the text or picture (c) the gap round content (d) space outside the border
-
17.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 140px;
padding: 15px;
border: 1px solid black;
margin: 20px;
} - 18.📦 In the box model, which part is the line round the box? (a) margin (b) padding (c) border (d) content
- 19.📦 In the box model, which part is a solid or dotted edge? (a) content (b) margin (c) padding (d) border
-
20.📦 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: 5px solid black;
margin: 0px;
} -
21.📦 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: 15px;
border: 1px solid black;
margin: 5px;
} -
22.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 130px;
padding: 20px;
border: 4px solid black;
margin: 0px;
} -
23.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 150px;
padding: 5px;
border: 3px solid black;
margin: 20px;
} - 24.Which of these is padding? (a) space outside the border (b) a solid or dotted edge (c) the line round the box (d) the gap round content
- 25.Which of these is margin? (a) the text or picture (b) the gap to other boxes (c) a solid or dotted edge (d) space inside the border
-
26.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 60px;
padding: 15px;
border: 1px solid black;
margin: 5px;
} - 27.True or false: the border is the gap to other boxes. (a) True (b) False
- 28.True or false: the content is the text or picture. (a) False (b) True
-
29.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 280px;
padding: 15px;
border: 4px solid black;
margin: 5px;
} -
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: 220px;
padding: 5px;
border: 4px solid black;
margin: 10px;
} - 31.True or false: margin is space outside the border. (a) True (b) False
-
32.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 80px;
padding: 10px;
border: 5px solid black;
margin: 5px;
} -
33.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 210px;
padding: 25px;
border: 5px solid black;
margin: 5px;
} -
34.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 120px;
padding: 5px;
border: 1px solid black;
margin: 0px;
} - 35.📦 In the box model, which part is the gap to other boxes? (a) padding (b) margin (c) border (d) content
- 36.True or false: the border is space inside the border. (a) False (b) True
-
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: 1px solid black;
margin: 10px;
} -
38.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 200px;
padding: 15px;
border: 1px solid black;
margin: 0px;
} - 39.True or false: padding is the gap to other boxes. (a) True (b) False
- 40.Which of these is the border? (a) a solid or dotted edge (b) the text or picture (c) the gap to other boxes (d) the gap round content
Answer key
- 212
- False
- 120
- True
- 264
- padding
- the line round the box
- the text or picture
- margin
- 220
- False
- 350
- False
- 272
- 212
- space outside the border
- 212
- border
- border
- 80
- 172
- 178
- 206
- the gap round content
- the gap to other boxes
- 102
- False
- True
- 328
- 238
- True
- 120
- 270
- 132
- margin
- False
- 112
- 232
- False
- a solid or dotted edge
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids