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: 200px;
padding: 15px;
border: 1px solid black;
margin: 5px;
} - 2.📦 In the box model, which part is space outside the border? (a) padding (b) content (c) margin (d) border
-
3.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 70px;
padding: 15px;
border: 5px solid black;
margin: 20px;
} - 4.True or false: the content is the gap round content. (a) True (b) False
- 5.📦 In the box model, which part is space inside the border? (a) content (b) border (c) padding (d) margin
-
6.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 100px;
padding: 25px;
border: 3px solid black;
margin: 0px;
} - 7.True or false: margin is the text or picture. (a) False (b) True
-
8.📦 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: 30px;
border: 3px solid black;
margin: 15px;
} - 9.True or false: the content is the gap to other boxes. (a) False (b) True
- 10.True or false: padding is the text or picture. (a) True (b) False
-
11.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 150px;
padding: 20px;
border: 3px solid black;
margin: 20px;
} - 12.Which of these is padding? (a) space outside the border (b) the gap round content (c) the line round the box (d) the text or picture
-
13.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 130px;
padding: 10px;
border: 1px solid black;
margin: 5px;
} - 14.Which of these is the content? (a) space outside the border (b) the text or picture (c) the gap round content (d) the gap to other boxes
-
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: 80px;
padding: 20px;
border: 4px solid black;
margin: 15px;
} - 16.Which of these is margin? (a) a solid or dotted edge (b) the text or picture (c) the line round the box (d) the gap to other boxes
-
17.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 130px;
padding: 5px;
border: 4px solid black;
margin: 0px;
} - 18.True or false: padding is the gap round content. (a) True (b) False
-
19.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 50px;
padding: 25px;
border: 2px solid black;
margin: 15px;
} - 20.True or false: margin is the gap round content. (a) False (b) True
-
21.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 120px;
padding: 5px;
border: 2px solid black;
margin: 0px;
} - 22.True or false: the border is space inside the border. (a) False (b) True
-
23.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 140px;
padding: 15px;
border: 1px solid black;
margin: 0px;
} -
24.📦 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;
} -
25.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 130px;
padding: 15px;
border: 1px solid black;
margin: 20px;
} - 26.Which of these is margin? (a) the gap round content (b) space outside the border (c) the text or picture (d) a solid or dotted edge
- 27.📦 In the box model, which part is the gap to other boxes? (a) content (b) border (c) padding (d) margin
-
28.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 280px;
padding: 15px;
border: 3px solid black;
margin: 10px;
} -
29.📦 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: 15px;
border: 1px solid black;
margin: 15px;
} -
30.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 110px;
padding: 5px;
border: 2px solid black;
margin: 20px;
} - 31.📦 In the box model, which part is the line round the box? (a) content (b) border (c) margin (d) padding
-
32.📦 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: 15px;
border: 1px solid black;
margin: 0px;
} -
33.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 140px;
padding: 25px;
border: 2px solid black;
margin: 5px;
} - 34.True or false: the content is space inside the border. (a) False (b) True
-
35.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 120px;
padding: 25px;
border: 1px solid black;
margin: 5px;
} -
36.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 40px;
padding: 20px;
border: 1px solid black;
margin: 0px;
} - 37.Which of these is padding? (a) the line round the box (b) a solid or dotted edge (c) space outside the border (d) space inside the border
-
38.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 200px;
padding: 25px;
border: 1px solid black;
margin: 0px;
} - 39.True or false: margin is space outside the border. (a) False (b) True
- 40.True or false: the content is the text or picture. (a) True (b) False
Answer key
- 242
- margin
- 150
- False
- padding
- 156
- False
- 336
- False
- False
- 236
- the gap round content
- 162
- the text or picture
- 128
- the gap to other boxes
- 148
- True
- 134
- False
- 134
- False
- 172
- 198
- 202
- space outside the border
- margin
- 336
- 282
- 164
- border
- 322
- 204
- False
- 182
- 82
- space inside the border
- 252
- True
- True
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids