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 top to bottom (px) does this box take in all, margin included?
.box {
height: 130px;
padding: 5px;
border: 1px solid black;
margin: 5px;
} -
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: 280px;
padding: 5px;
border: 1px solid black;
margin: 20px;
} - 3.📦 In the box model, which part is space outside the border? (a) padding (b) content (c) margin (d) border
-
4.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 110px;
padding: 15px;
border: 2px solid black;
margin: 5px;
} - 5.Which of these is margin? (a) the line round the box (b) the gap to other boxes (c) the text or picture (d) a solid or dotted edge
-
6.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 190px;
padding: 15px;
border: 4px solid black;
margin: 0px;
} - 7.📦 In the box model, which part is the text or picture? (a) content (b) margin (c) padding (d) border
- 8.📦 In the box model, which part is the gap to other boxes? (a) padding (b) border (c) content (d) margin
- 9.True or false: margin is the gap to other boxes. (a) True (b) False
- 10.Which of these is the border? (a) space inside the border (b) the gap to other boxes (c) a solid or dotted edge (d) the text or picture
- 11.📦 In the box model, which part is the gap round content? (a) border (b) content (c) margin (d) padding
-
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: 130px;
padding: 30px;
border: 3px solid black;
margin: 15px;
} -
13.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 160px;
padding: 30px;
border: 3px solid black;
margin: 10px;
} - 14.Which of these is padding? (a) the gap to other boxes (b) the line round the box (c) space outside the border (d) the gap round content
-
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: 2px solid black;
margin: 0px;
} -
16.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 150px;
padding: 5px;
border: 2px solid black;
margin: 0px;
} - 17.True or false: the border is the gap round content. (a) True (b) False
-
18.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 120px;
padding: 5px;
border: 2px solid black;
margin: 0px;
} - 19.Which of these is the border? (a) the text or picture (b) space outside the border (c) space inside the border (d) the line round the box
- 20.True or false: margin is a solid or dotted edge. (a) False (b) True
- 21.Which of these is the content? (a) the gap to other boxes (b) the text or picture (c) space outside the border (d) the line round the box
-
22.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 100px;
padding: 25px;
border: 3px solid black;
margin: 5px;
} -
23.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 210px;
padding: 20px;
border: 1px solid black;
margin: 5px;
} - 24.Which of these is margin? (a) space outside the border (b) space inside the border (c) a solid or dotted edge (d) the gap round content
-
25.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 170px;
padding: 30px;
border: 3px solid black;
margin: 15px;
} - 26.True or false: the content is the gap to other boxes. (a) True (b) False
-
27.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 180px;
padding: 15px;
border: 4px solid black;
margin: 5px;
} - 28.📦 In the box model, which part is a solid or dotted edge? (a) border (b) padding (c) margin (d) content
- 29.True or false: padding is the gap to other boxes. (a) True (b) False
- 30.📦 In the box model, which part is the line round the box? (a) content (b) border (c) margin (d) padding
-
31.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 90px;
padding: 20px;
border: 4px solid black;
margin: 10px;
} - 32.True or false: the border is space inside the border. (a) False (b) True
- 33.True or false: margin is space inside the border. (a) False (b) True
-
34.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 100px;
padding: 30px;
border: 3px solid black;
margin: 5px;
} - 35.True or false: margin is space outside the border. (a) True (b) False
- 36.True or false: padding is the gap round content. (a) True (b) False
-
37.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 60px;
padding: 20px;
border: 2px solid black;
margin: 10px;
} - 38.Which of these is padding? (a) space outside the border (b) space inside the border (c) the text or picture (d) the line round the box
-
39.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 140px;
padding: 5px;
border: 5px solid black;
margin: 0px;
} -
40.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 50px;
padding: 5px;
border: 4px solid black;
margin: 5px;
}
Answer key
- 152
- 292
- margin
- 154
- the gap to other boxes
- 228
- content
- margin
- True
- a solid or dotted edge
- padding
- 196
- 246
- the gap round content
- 224
- 164
- False
- 134
- the line round the box
- False
- the text or picture
- 166
- 262
- space outside the border
- 266
- False
- 228
- border
- False
- border
- 158
- False
- False
- 176
- True
- True
- 124
- space inside the border
- 160
- 78
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids