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: 200px;
padding: 15px;
border: 1px solid black;
margin: 20px;
} - 2.Which of these is margin? (a) the gap round content (b) the line round the box (c) the text or picture (d) the gap to other boxes
- 3.True or false: margin is the gap round content. (a) False (b) True
- 4.True or false: padding is the line round the box. (a) False (b) True
-
5.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 190px;
padding: 15px;
border: 2px solid black;
margin: 0px;
} -
6.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 70px;
padding: 20px;
border: 4px solid black;
margin: 10px;
} -
7.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 80px;
padding: 20px;
border: 2px solid black;
margin: 0px;
} - 8.📦 In the box model, which part is the gap round content? (a) content (b) margin (c) padding (d) border
-
9.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 270px;
padding: 20px;
border: 1px solid black;
margin: 20px;
} - 10.True or false: the content is a solid or dotted edge. (a) False (b) True
- 11.Which of these is padding? (a) a solid or dotted edge (b) the text or picture (c) the gap round content (d) the gap to other boxes
- 12.📦 In the box model, which part is the text or picture? (a) border (b) padding (c) content (d) margin
-
13.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 270px;
padding: 5px;
border: 3px solid black;
margin: 0px;
} -
14.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 70px;
padding: 30px;
border: 1px solid black;
margin: 20px;
} -
15.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 90px;
padding: 15px;
border: 4px solid black;
margin: 0px;
} - 16.Which of these is margin? (a) the text or picture (b) space inside the border (c) the line round the box (d) space outside the border
- 17.📦 In the box model, which part is the gap to other boxes? (a) padding (b) content (c) margin (d) border
- 18.📦 In the box model, which part is space outside the border? (a) padding (b) content (c) margin (d) border
- 19.Which of these is the border? (a) space outside the border (b) the gap to other boxes (c) a solid or dotted edge (d) the gap round content
-
20.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 300px;
padding: 20px;
border: 1px solid black;
margin: 15px;
} - 21.📦 In the box model, which part is the line round the box? (a) border (b) margin (c) padding (d) content
-
22.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 200px;
padding: 25px;
border: 4px solid black;
margin: 10px;
} - 23.📦 In the box model, which part is a solid or dotted edge? (a) border (b) padding (c) margin (d) content
-
24.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 270px;
padding: 25px;
border: 1px solid black;
margin: 5px;
} - 25.True or false: the border is a solid or dotted edge. (a) False (b) True
-
26.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 180px;
padding: 10px;
border: 2px solid black;
margin: 20px;
} - 27.True or false: the border is the gap to other boxes. (a) True (b) False
-
28.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 280px;
padding: 15px;
border: 2px solid black;
margin: 0px;
} -
29.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 80px;
padding: 10px;
border: 3px solid black;
margin: 10px;
} -
30.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 220px;
padding: 30px;
border: 2px solid black;
margin: 0px;
} - 31.True or false: margin is space outside the border. (a) True (b) False
-
32.📦 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: 10px;
border: 5px solid black;
margin: 0px;
} -
33.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 60px;
padding: 25px;
border: 2px solid black;
margin: 15px;
} -
34.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 180px;
padding: 15px;
border: 2px solid black;
margin: 10px;
} - 35.True or false: padding is space outside the border. (a) True (b) False
- 36.📦 In the box model, which part is space inside the border? (a) margin (b) border (c) content (d) padding
- 37.True or false: the content is the text or picture. (a) True (b) False
-
38.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 60px;
padding: 30px;
border: 1px solid black;
margin: 20px;
} -
39.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 60px;
padding: 25px;
border: 4px solid black;
margin: 5px;
} -
40.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 260px;
padding: 20px;
border: 3px solid black;
margin: 5px;
}
Answer key
- 232
- the gap to other boxes
- False
- False
- 224
- 138
- 124
- padding
- 312
- False
- the gap round content
- content
- 286
- 172
- 128
- space outside the border
- margin
- margin
- a solid or dotted edge
- 372
- border
- 278
- border
- 332
- True
- 244
- False
- 314
- 126
- 284
- True
- 100
- 144
- 234
- False
- padding
- True
- 162
- 128
- 316
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids