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: 100px;
padding: 20px;
border: 3px solid black;
margin: 20px;
} -
2.📦 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: 15px;
border: 1px solid black;
margin: 0px;
} -
3.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 160px;
padding: 20px;
border: 3px solid black;
margin: 10px;
} - 4.True or false: the border is a solid or dotted edge. (a) False (b) True
- 5.True or false: margin is space outside the border. (a) True (b) False
- 6.True or false: padding is space inside the border. (a) False (b) True
- 7.True or false: the border is the text or picture. (a) True (b) False
- 8.Which of these is the border? (a) the gap round content (b) the text or picture (c) space inside the border (d) the line round the box
- 9.Which of these is the border? (a) the gap to other boxes (b) the gap round content (c) the text or picture (d) a solid or dotted edge
- 10.True or false: margin is the gap to other boxes. (a) False (b) True
-
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: 50px;
padding: 20px;
border: 3px solid black;
margin: 10px;
} - 12.📦 In the box model, which part is the gap to other boxes? (a) margin (b) content (c) border (d) padding
- 13.Which of these is padding? (a) the text or picture (b) the gap round content (c) a solid or dotted edge (d) the gap to other boxes
-
14.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 260px;
padding: 30px;
border: 1px solid black;
margin: 20px;
} - 15.True or false: padding is a solid or dotted edge. (a) True (b) False
-
16.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 290px;
padding: 30px;
border: 4px solid black;
margin: 5px;
} -
17.📦 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: 5px solid black;
margin: 10px;
} -
18.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 130px;
padding: 25px;
border: 4px solid black;
margin: 0px;
} - 19.Which of these is the content? (a) the gap round content (b) the text or picture (c) space inside the border (d) a solid or dotted edge
-
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: 300px;
padding: 20px;
border: 4px solid black;
margin: 10px;
} -
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: 240px;
padding: 10px;
border: 1px solid black;
margin: 20px;
} - 22.📦 In the box model, which part is the text or picture? (a) margin (b) border (c) content (d) padding
- 23.True or false: the border is space inside the border. (a) False (b) True
-
24.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 200px;
padding: 20px;
border: 4px solid black;
margin: 0px;
} -
25.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 200px;
padding: 15px;
border: 4px solid black;
margin: 20px;
} -
26.📦 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: 30px;
border: 2px solid black;
margin: 5px;
} - 27.📦 In the box model, which part is space inside the border? (a) border (b) padding (c) content (d) margin
-
28.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 190px;
padding: 25px;
border: 2px solid black;
margin: 0px;
} -
29.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 220px;
padding: 15px;
border: 4px solid black;
margin: 15px;
} -
30.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 220px;
padding: 25px;
border: 5px solid black;
margin: 20px;
} -
31.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 90px;
padding: 30px;
border: 2px solid black;
margin: 15px;
} - 32.📦 In the box model, which part is a solid or dotted edge? (a) margin (b) content (c) border (d) padding
- 33.True or false: the border is the gap to other boxes. (a) False (b) True
- 34.📦 In the box model, which part is the gap round content? (a) content (b) margin (c) padding (d) border
-
35.📦 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: 30px;
border: 1px solid black;
margin: 15px;
} - 36.True or false: the content is the gap to other boxes. (a) True (b) False
-
37.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 170px;
padding: 25px;
border: 5px solid black;
margin: 20px;
} - 38.📦 In the box model, which part is the line round the box? (a) content (b) margin (c) border (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: 5px;
} -
40.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 190px;
padding: 30px;
border: 4px solid black;
margin: 10px;
}
Answer key
- 146
- 242
- 226
- True
- True
- True
- False
- the line round the box
- a solid or dotted edge
- True
- 96
- margin
- the gap round content
- 362
- False
- 358
- 180
- 188
- the text or picture
- 348
- 262
- content
- False
- 248
- 278
- 164
- padding
- 244
- 288
- 320
- 184
- border
- False
- padding
- 202
- False
- 270
- border
- 344
- 258
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids