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.Which of these is padding? (a) the gap to other boxes (b) space inside the border (c) the line round the box (d) the text or picture
- 2.Which of these is margin? (a) the gap round content (b) a solid or dotted edge (c) the line round the box (d) space outside the border
-
3.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 120px;
padding: 25px;
border: 2px solid black;
margin: 20px;
} -
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: 100px;
padding: 25px;
border: 1px solid black;
margin: 5px;
} - 5.True or false: margin is space outside the border. (a) False (b) True
-
6.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 60px;
padding: 10px;
border: 5px solid black;
margin: 20px;
} - 7.📦 In the box model, which part is the gap round content? (a) border (b) margin (c) padding (d) content
- 8.📦 In the box model, which part is the text or picture? (a) content (b) padding (c) border (d) margin
-
9.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 80px;
padding: 15px;
border: 1px solid black;
margin: 15px;
} -
10.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 300px;
padding: 10px;
border: 4px solid black;
margin: 5px;
} -
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: 180px;
padding: 5px;
border: 2px solid black;
margin: 15px;
} - 12.True or false: padding is a solid or dotted edge. (a) True (b) False
-
13.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 130px;
padding: 20px;
border: 4px solid black;
margin: 20px;
} - 14.📦 In the box model, which part is a solid or dotted edge? (a) border (b) margin (c) content (d) padding
-
15.📦 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: 5px;
border: 4px solid black;
margin: 10px;
} - 16.📦 In the box model, which part is the gap to other boxes? (a) margin (b) padding (c) content (d) border
-
17.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 110px;
padding: 5px;
border: 3px solid black;
margin: 5px;
} -
18.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 170px;
padding: 15px;
border: 2px solid black;
margin: 0px;
} -
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: 230px;
padding: 10px;
border: 1px solid black;
margin: 0px;
} - 20.Which of these is the content? (a) the gap round content (b) the text or picture (c) the gap to other boxes (d) space inside the border
- 21.True or false: the border is a solid or dotted edge. (a) True (b) False
-
22.📦 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: 15px;
border: 2px solid black;
margin: 5px;
} -
23.📦 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: 5px solid black;
margin: 15px;
} - 24.True or false: padding is the line round the box. (a) True (b) False
-
25.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 140px;
padding: 10px;
border: 5px solid black;
margin: 0px;
} -
26.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 130px;
padding: 25px;
border: 1px solid black;
margin: 5px;
} -
27.📦 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: 10px;
border: 2px solid black;
margin: 0px;
} - 28.📦 In the box model, which part is space outside the border? (a) padding (b) border (c) margin (d) content
-
29.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 170px;
padding: 25px;
border: 4px solid black;
margin: 0px;
} - 30.Which of these is padding? (a) the text or picture (b) the line round the box (c) the gap to other boxes (d) the gap round content
-
31.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 50px;
padding: 15px;
border: 1px solid black;
margin: 10px;
} - 32.Which of these is the border? (a) space outside the border (b) the gap to other boxes (c) the text or picture (d) a solid or dotted edge
-
33.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 270px;
padding: 30px;
border: 2px solid black;
margin: 0px;
} - 34.True or false: the border is the gap round content. (a) False (b) True
- 35.True or false: margin is the gap round content. (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: 110px;
padding: 10px;
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: 130px;
padding: 25px;
border: 5px solid black;
margin: 5px;
} -
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: 80px;
padding: 30px;
border: 1px solid black;
margin: 5px;
} - 39.True or false: margin is the text or picture. (a) False (b) True
-
40.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 160px;
padding: 15px;
border: 2px solid black;
margin: 15px;
}
Answer key
- space inside the border
- space outside the border
- 214
- 152
- True
- 130
- padding
- content
- 142
- 338
- 194
- False
- 218
- border
- 228
- margin
- 136
- 204
- 252
- the text or picture
- True
- 304
- 350
- False
- 170
- 192
- 144
- margin
- 228
- the gap round content
- 102
- a solid or dotted edge
- 334
- False
- False
- 136
- 190
- 142
- False
- 224
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids