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: 200px;
padding: 5px;
border: 4px solid black;
margin: 15px;
} - 2.📦 In the box model, which part is the line round the box? (a) content (b) padding (c) border (d) margin
- 3.📦 In the box model, which part is a solid or dotted edge? (a) margin (b) padding (c) content (d) border
- 4.📦 In the box model, which part is the gap round content? (a) padding (b) content (c) margin (d) border
-
5.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 200px;
padding: 5px;
border: 3px solid black;
margin: 10px;
} - 6.True or false: the border is space inside the border. (a) True (b) False
- 7.Which of these is padding? (a) space outside the border (b) space inside the border (c) a solid or dotted edge (d) the gap to other boxes
-
8.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 80px;
padding: 10px;
border: 4px solid black;
margin: 20px;
} - 9.Which of these is margin? (a) space inside the border (b) the line round the box (c) the text or picture (d) space outside the border
- 10.📦 In the box model, which part is the gap to other boxes? (a) padding (b) border (c) content (d) margin
-
11.📦 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: 10px;
border: 2px solid black;
margin: 5px;
} - 12.True or false: padding is space inside the border. (a) False (b) True
- 13.Which of these is the border? (a) the text or picture (b) the gap round content (c) space outside the border (d) the line round the box
- 14.Which of these is padding? (a) a solid or dotted edge (b) space outside the border (c) the gap to other boxes (d) the gap round content
-
15.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 210px;
padding: 5px;
border: 4px solid black;
margin: 20px;
} -
16.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 190px;
padding: 5px;
border: 2px solid black;
margin: 10px;
} - 17.📦 In the box model, which part is the text or picture? (a) padding (b) content (c) border (d) margin
-
18.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 80px;
padding: 20px;
border: 3px solid black;
margin: 15px;
} - 19.Which of these is margin? (a) the gap to other boxes (b) the line round the box (c) the gap round content (d) a solid or dotted edge
-
20.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 160px;
padding: 15px;
border: 4px solid black;
margin: 20px;
} -
21.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 140px;
padding: 15px;
border: 3px solid black;
margin: 0px;
} -
22.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 100px;
padding: 10px;
border: 1px solid black;
margin: 0px;
} - 23.Which of these is the content? (a) space inside the border (b) the gap to other boxes (c) the text or picture (d) the line round the box
- 24.True or false: padding is a solid or dotted edge. (a) False (b) True
- 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: 50px;
padding: 20px;
border: 3px solid black;
margin: 10px;
} - 27.True or false: the border is space outside the border. (a) False (b) True
-
28.📦 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: 20px;
border: 3px solid black;
margin: 5px;
} -
29.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 170px;
padding: 5px;
border: 4px solid black;
margin: 5px;
} - 30.True or false: padding is the gap round content. (a) True (b) False
-
31.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 250px;
padding: 25px;
border: 1px solid black;
margin: 20px;
} -
32.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 170px;
padding: 25px;
border: 2px solid black;
margin: 0px;
} - 33.True or false: padding is space outside the border. (a) True (b) False
-
34.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 210px;
padding: 30px;
border: 4px solid black;
margin: 5px;
} - 35.Which of these is the border? (a) the text or picture (b) space outside the border (c) the gap round content (d) a solid or dotted edge
-
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: 150px;
padding: 25px;
border: 3px 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: 200px;
padding: 25px;
border: 1px solid black;
margin: 10px;
} - 38.📦 In the box model, which part is space inside the border? (a) border (b) content (c) margin (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: 280px;
padding: 30px;
border: 2px solid black;
margin: 15px;
} - 40.True or false: the content is the line round the box. (a) True (b) False
Answer key
- 248
- border
- border
- padding
- 236
- False
- space inside the border
- 148
- space outside the border
- margin
- 104
- True
- the line round the box
- the gap round content
- 268
- 224
- content
- 156
- the gap to other boxes
- 238
- 176
- 122
- the text or picture
- False
- False
- 116
- False
- 176
- 198
- True
- 342
- 224
- False
- 288
- a solid or dotted edge
- 206
- 252
- padding
- 344
- False
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids