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: 80px;
padding: 10px;
border: 5px solid black;
margin: 0px;
} -
2.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 60px;
padding: 10px;
border: 2px solid black;
margin: 5px;
} - 3.📦 In the box model, which part is space inside the border? (a) content (b) border (c) margin (d) padding
-
4.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 270px;
padding: 25px;
border: 4px solid black;
margin: 15px;
} - 5.Which of these is margin? (a) the text or picture (b) the line round the box (c) the gap to other boxes (d) the gap round content
- 6.Which of these is the border? (a) the gap round content (b) space inside the border (c) the text or picture (d) a solid or dotted edge
-
7.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 70px;
padding: 15px;
border: 3px solid black;
margin: 0px;
} -
8.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 90px;
padding: 10px;
border: 4px solid black;
margin: 20px;
} - 9.Which of these is padding? (a) the text or picture (b) space outside the border (c) space inside the border (d) the gap to other boxes
- 10.📦 In the box model, which part is the gap round content? (a) border (b) padding (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: 110px;
padding: 5px;
border: 1px solid black;
margin: 10px;
} - 12.True or false: the content is the gap to other boxes. (a) True (b) False
- 13.True or false: the content is space outside the border. (a) False (b) True
- 14.📦 In the box model, which part is space outside the border? (a) content (b) padding (c) border (d) margin
- 15.Which of these is the border? (a) the gap round content (b) the gap to other boxes (c) space inside the border (d) the line round the box
-
16.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 100px;
padding: 5px;
border: 5px solid black;
margin: 5px;
} -
17.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 250px;
padding: 25px;
border: 4px solid black;
margin: 5px;
} - 18.Which of these is the content? (a) a solid or dotted edge (b) the gap to other boxes (c) the text or picture (d) space outside the border
- 19.True or false: margin is the gap round content. (a) True (b) False
- 20.True or false: padding is space inside the border. (a) True (b) False
-
21.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 100px;
padding: 10px;
border: 1px solid black;
margin: 20px;
} -
22.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 40px;
padding: 30px;
border: 2px solid black;
margin: 15px;
} -
23.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 280px;
padding: 20px;
border: 4px solid black;
margin: 10px;
} -
24.📦 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: 30px;
border: 1px solid black;
margin: 15px;
} -
25.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 160px;
padding: 10px;
border: 2px solid black;
margin: 20px;
} -
26.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 170px;
padding: 10px;
border: 4px solid black;
margin: 0px;
} -
27.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 160px;
padding: 20px;
border: 1px solid black;
margin: 20px;
} - 28.📦 In the box model, which part is a solid or dotted edge? (a) border (b) margin (c) padding (d) content
- 29.True or false: margin is space outside the border. (a) True (b) False
- 30.True or false: the content is a solid or dotted edge. (a) False (b) True
-
31.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 70px;
padding: 25px;
border: 5px solid black;
margin: 5px;
} - 32.True or false: the content is the text or picture. (a) False (b) True
- 33.📦 In the box model, which part is the gap to other boxes? (a) border (b) content (c) padding (d) margin
-
34.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 110px;
padding: 30px;
border: 5px solid black;
margin: 5px;
} - 35.True or false: margin is the text or picture. (a) False (b) True
-
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: 120px;
padding: 25px;
border: 4px solid black;
margin: 15px;
} -
37.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 270px;
padding: 20px;
border: 3px solid black;
margin: 15px;
} -
38.📦 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: 15px;
border: 5px solid black;
margin: 5px;
} -
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: 230px;
padding: 5px;
border: 1px solid black;
margin: 20px;
} -
40.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 170px;
padding: 10px;
border: 5px solid black;
margin: 10px;
}
Answer key
- 110
- 94
- padding
- 358
- the gap to other boxes
- a solid or dotted edge
- 106
- 158
- space inside the border
- padding
- 122
- False
- False
- margin
- the line round the box
- 130
- 318
- the text or picture
- False
- True
- 162
- 134
- 348
- 262
- 224
- 198
- 242
- border
- True
- False
- 140
- True
- margin
- 190
- False
- 178
- 346
- 340
- 242
- 220
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids