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.📦 In the box model, which part is the gap to other boxes? (a) margin (b) border (c) padding (d) content
- 2.Which of these is the border? (a) the gap round content (b) space outside the border (c) the line round the box (d) the gap to other boxes
-
3.📦 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: 15px;
border: 1px solid black;
margin: 5px;
} -
4.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 200px;
padding: 10px;
border: 5px solid black;
margin: 5px;
} - 5.Which of these is padding? (a) the text or picture (b) space inside the border (c) a solid or dotted edge (d) the line round the box
- 6.True or false: the content is the text or picture. (a) True (b) False
- 7.Which of these is margin? (a) the gap to other boxes (b) a solid or dotted edge (c) the text or picture (d) space inside the border
-
8.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 240px;
padding: 15px;
border: 2px solid black;
margin: 5px;
} - 9.📦 In the box model, which part is the gap round content? (a) padding (b) content (c) border (d) margin
- 10.Which of these is the border? (a) the text or picture (b) the gap round content (c) the gap to other boxes (d) a solid or dotted edge
-
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: 220px;
padding: 5px;
border: 4px solid black;
margin: 10px;
} -
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: 200px;
padding: 5px;
border: 5px solid black;
margin: 0px;
} -
13.📦 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: 10px;
border: 1px solid black;
margin: 5px;
} -
14.📦 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: 5px solid black;
margin: 10px;
} - 15.Which of these is the content? (a) the text or picture (b) a solid or dotted edge (c) space inside the border (d) the line round the box
-
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: 260px;
padding: 30px;
border: 4px solid black;
margin: 10px;
} -
17.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 100px;
padding: 10px;
border: 2px solid black;
margin: 5px;
} - 18.True or false: the border is the line round the box. (a) True (b) False
- 19.📦 In the box model, which part is a solid or dotted edge? (a) content (b) padding (c) border (d) margin
-
20.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 90px;
padding: 10px;
border: 5px solid black;
margin: 0px;
} - 21.True or false: the content is a solid or dotted edge. (a) True (b) False
- 22.📦 In the box model, which part is the line round the box? (a) content (b) padding (c) border (d) margin
-
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: 250px;
padding: 5px;
border: 3px solid black;
margin: 0px;
} - 24.True or false: padding is the gap round content. (a) False (b) True
- 25.Which of these is padding? (a) the text or picture (b) the gap round content (c) the line round the box (d) the gap to other boxes
-
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: 50px;
padding: 25px;
border: 1px solid black;
margin: 15px;
} - 27.True or false: the content is space outside the border. (a) False (b) True
- 28.True or false: padding is space inside the border. (a) False (b) True
- 29.📦 In the box model, which part is the text or picture? (a) padding (b) margin (c) border (d) content
- 30.📦 In the box model, which part is space inside the border? (a) padding (b) border (c) margin (d) content
-
31.📦 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: 25px;
border: 1px solid black;
margin: 15px;
} - 32.True or false: the border is the gap round content. (a) True (b) False
-
33.📦 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: 2px solid black;
margin: 5px;
} -
34.📦 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: 15px;
border: 1px solid black;
margin: 5px;
} - 35.True or false: the border is space inside the border. (a) False (b) True
- 36.True or false: padding is the text or picture. (a) True (b) False
- 37.True or false: margin is space inside the border. (a) False (b) True
- 38.True or false: margin is space outside the border. (a) False (b) True
-
39.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 80px;
padding: 5px;
border: 2px solid black;
margin: 5px;
} -
40.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 50px;
padding: 25px;
border: 4px solid black;
margin: 0px;
}
Answer key
- margin
- the line round the box
- 152
- 240
- space inside the border
- True
- the gap to other boxes
- 284
- padding
- a solid or dotted edge
- 238
- 220
- 202
- 100
- the text or picture
- 328
- 134
- True
- border
- 120
- False
- border
- 266
- True
- the gap round content
- 102
- False
- True
- content
- padding
- 282
- False
- 144
- 132
- False
- False
- False
- True
- 104
- 108
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids