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.True or false: padding is the text or picture. (a) False (b) True
- 2.Which of these is margin? (a) the gap round content (b) the text or picture (c) the line round the box (d) space outside the border
- 3.True or false: padding is the gap round content. (a) True (b) False
-
4.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 110px;
padding: 5px;
border: 4px solid black;
margin: 15px;
} - 5.Which of these is padding? (a) the line round the box (b) the gap to other boxes (c) a solid or dotted edge (d) space inside the border
- 6.📦 In the box model, which part is the line round the box? (a) content (b) margin (c) padding (d) border
-
7.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 100px;
padding: 25px;
border: 3px solid black;
margin: 5px;
} - 8.📦 In the box model, which part is the gap round content? (a) padding (b) margin (c) border (d) content
-
9.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 120px;
padding: 20px;
border: 3px solid black;
margin: 20px;
} -
10.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 240px;
padding: 15px;
border: 4px solid black;
margin: 0px;
} -
11.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 60px;
padding: 10px;
border: 1px solid black;
margin: 0px;
} -
12.📦 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: 25px;
border: 2px solid black;
margin: 10px;
} - 13.Which of these is the border? (a) space inside the border (b) a solid or dotted edge (c) the gap to other boxes (d) space outside the border
-
14.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 220px;
padding: 15px;
border: 2px solid black;
margin: 0px;
} - 15.True or false: padding is a solid or dotted edge. (a) False (b) True
- 16.True or false: the border is space outside the border. (a) False (b) True
- 17.Which of these is padding? (a) a solid or dotted edge (b) the gap round content (c) space outside the border (d) the gap to other boxes
- 18.📦 In the box model, which part is space outside the border? (a) margin (b) content (c) border (d) padding
-
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: 210px;
padding: 20px;
border: 3px solid black;
margin: 10px;
} -
20.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 140px;
padding: 25px;
border: 4px solid black;
margin: 5px;
} -
21.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 190px;
padding: 10px;
border: 5px solid black;
margin: 10px;
} -
22.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 70px;
padding: 15px;
border: 2px solid black;
margin: 5px;
} - 23.True or false: the border is the gap round content. (a) False (b) True
-
24.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 260px;
padding: 25px;
border: 5px solid black;
margin: 5px;
} - 25.True or false: the content is the gap to other boxes. (a) False (b) True
-
26.📦 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: 20px;
} - 27.True or false: margin is the text or picture. (a) False (b) True
- 28.📦 In the box model, which part is a solid or dotted edge? (a) padding (b) border (c) content (d) margin
-
29.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 80px;
padding: 30px;
border: 4px solid black;
margin: 20px;
} -
30.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 100px;
padding: 15px;
border: 2px solid black;
margin: 0px;
} -
31.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 170px;
padding: 20px;
border: 1px solid black;
margin: 15px;
} -
32.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 70px;
padding: 5px;
border: 3px solid black;
margin: 5px;
} - 33.True or false: the content is the gap round content. (a) True (b) False
-
34.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 180px;
padding: 5px;
border: 5px solid black;
margin: 5px;
} -
35.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 200px;
padding: 20px;
border: 1px solid black;
margin: 20px;
} -
36.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 100px;
padding: 10px;
border: 5px solid black;
margin: 10px;
} -
37.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 110px;
padding: 20px;
border: 3px solid black;
margin: 0px;
} - 38.True or false: padding is space outside the border. (a) True (b) False
-
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: 60px;
padding: 25px;
border: 4px solid black;
margin: 0px;
} -
40.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 200px;
padding: 5px;
border: 2px solid black;
margin: 20px;
}
Answer key
- False
- space outside the border
- True
- 128
- space inside the border
- border
- 166
- padding
- 206
- 278
- 82
- 324
- a solid or dotted edge
- 254
- False
- False
- the gap round content
- margin
- 256
- 208
- 240
- 114
- False
- 330
- False
- 124
- False
- border
- 188
- 134
- 242
- 96
- False
- 210
- 282
- 150
- 156
- False
- 118
- 254
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids