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: 10px;
border: 5px solid black;
margin: 5px;
} - 2.Which of these is margin? (a) space inside the border (b) the gap to other boxes (c) the gap round content (d) the line round the box
- 3.📦 In the box model, which part is the gap round content? (a) margin (b) padding (c) border (d) content
-
4.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 300px;
padding: 5px;
border: 2px solid black;
margin: 0px;
} - 5.True or false: padding is space inside the border. (a) False (b) True
-
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: 100px;
padding: 20px;
border: 2px solid black;
margin: 5px;
} -
7.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 40px;
padding: 25px;
border: 5px solid black;
margin: 15px;
} - 8.📦 In the box model, which part is space inside the border? (a) margin (b) border (c) content (d) padding
-
9.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 230px;
padding: 25px;
border: 4px solid black;
margin: 0px;
} - 10.Which of these is the border? (a) the gap round content (b) the gap to other boxes (c) a solid or dotted edge (d) space outside the border
-
11.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 300px;
padding: 30px;
border: 1px solid black;
margin: 15px;
} - 12.True or false: padding is the text or picture. (a) True (b) False
- 13.Which of these is the content? (a) the gap round content (b) a solid or dotted edge (c) the text or picture (d) the line round the box
- 14.True or false: the border is the line round the box. (a) True (b) False
-
15.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 140px;
padding: 10px;
border: 4px solid black;
margin: 0px;
} - 16.📦 In the box model, which part is the line round the box? (a) margin (b) padding (c) content (d) border
- 17.📦 In the box model, which part is space outside the border? (a) content (b) border (c) padding (d) margin
- 18.True or false: the border is space outside the border. (a) False (b) True
-
19.📦 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: 3px solid black;
margin: 10px;
} -
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: 90px;
padding: 10px;
border: 2px solid black;
margin: 10px;
} - 21.True or false: the border is a solid or dotted edge. (a) True (b) False
-
22.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 70px;
padding: 5px;
border: 2px solid black;
margin: 10px;
} -
23.📦 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: 0px;
} -
24.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 260px;
padding: 25px;
border: 4px solid black;
margin: 20px;
} - 25.Which of these is the border? (a) space inside the border (b) the gap to other boxes (c) the line round the box (d) the gap round content
-
26.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 210px;
padding: 5px;
border: 2px solid black;
margin: 15px;
} -
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: 180px;
padding: 5px;
border: 5px solid black;
margin: 0px;
} -
28.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 80px;
padding: 5px;
border: 3px solid black;
margin: 10px;
} -
29.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 160px;
padding: 30px;
border: 2px solid black;
margin: 10px;
} - 30.True or false: margin is the line round the box. (a) False (b) True
- 31.📦 In the box model, which part is the gap to other boxes? (a) content (b) margin (c) padding (d) border
- 32.True or false: margin is space outside the border. (a) True (b) False
-
33.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 210px;
padding: 25px;
border: 2px solid black;
margin: 15px;
} -
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: 50px;
padding: 5px;
border: 1px solid black;
margin: 10px;
} -
35.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 250px;
padding: 15px;
border: 3px solid black;
margin: 5px;
} - 36.Which of these is margin? (a) space inside the border (b) space outside the border (c) the line round the box (d) the gap round content
- 37.True or false: margin is the gap to other boxes. (a) False (b) True
- 38.📦 In the box model, which part is the text or picture? (a) border (b) margin (c) content (d) padding
-
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: 150px;
padding: 15px;
border: 5px solid black;
margin: 10px;
} -
40.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 150px;
padding: 20px;
border: 4px solid black;
margin: 20px;
}
Answer key
- 340
- the gap to other boxes
- padding
- 314
- True
- 144
- 130
- padding
- 288
- a solid or dotted edge
- 392
- False
- the text or picture
- True
- 168
- border
- margin
- False
- 156
- 114
- True
- 104
- 352
- 358
- the line round the box
- 254
- 200
- 116
- 244
- False
- margin
- True
- 294
- 62
- 296
- space outside the border
- True
- content
- 190
- 238
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids