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 round content (b) the line round the box (c) the text or picture (d) the gap to other boxes
-
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: 270px;
padding: 25px;
border: 4px solid black;
margin: 5px;
} -
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: 250px;
padding: 5px;
border: 4px solid black;
margin: 20px;
} - 4.True or false: padding is space outside the border. (a) False (b) True
-
5.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 80px;
padding: 5px;
border: 5px solid black;
margin: 0px;
} -
6.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 50px;
padding: 5px;
border: 3px solid black;
margin: 0px;
} -
7.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 170px;
padding: 5px;
border: 3px solid black;
margin: 10px;
} - 8.True or false: padding is the gap round content. (a) False (b) True
-
9.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 40px;
padding: 30px;
border: 1px solid black;
margin: 10px;
} -
10.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 170px;
padding: 15px;
border: 5px solid black;
margin: 15px;
} - 11.Which of these is the border? (a) the gap round content (b) space outside the border (c) the line round the box (d) the text or picture
-
12.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 150px;
padding: 25px;
border: 3px solid black;
margin: 15px;
} -
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: 150px;
padding: 15px;
border: 2px solid black;
margin: 15px;
} - 14.Which of these is the content? (a) the gap round content (b) space outside the border (c) the text or picture (d) space inside the border
-
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: 160px;
padding: 5px;
border: 1px solid black;
margin: 0px;
} - 16.📦 In the box model, which part is space inside the border? (a) content (b) margin (c) padding (d) border
-
17.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 50px;
padding: 10px;
border: 1px solid black;
margin: 10px;
} -
18.📦 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: 3px solid black;
margin: 5px;
} -
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: 20px;
border: 3px solid black;
margin: 5px;
} - 20.True or false: margin is space inside the border. (a) False (b) True
- 21.📦 In the box model, which part is the gap to other boxes? (a) padding (b) border (c) margin (d) content
-
22.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 100px;
padding: 10px;
border: 2px solid black;
margin: 10px;
} -
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: 170px;
padding: 5px;
border: 2px solid black;
margin: 20px;
} - 24.True or false: the border is the gap round content. (a) True (b) False
-
25.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 130px;
padding: 25px;
border: 1px solid black;
margin: 0px;
} - 26.Which of these is margin? (a) space inside the border (b) the line round the box (c) space outside the border (d) a solid or dotted edge
-
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: 60px;
padding: 10px;
border: 2px solid black;
margin: 10px;
} -
28.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 90px;
padding: 5px;
border: 5px solid black;
margin: 15px;
} - 29.📦 In the box model, which part is a solid or dotted edge? (a) padding (b) margin (c) content (d) border
- 30.Which of these is margin? (a) the text or picture (b) space inside the border (c) the gap round content (d) the gap to other boxes
- 31.True or false: margin is space outside the border. (a) True (b) False
-
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: 70px;
padding: 10px;
border: 2px solid black;
margin: 15px;
} -
33.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 60px;
padding: 10px;
border: 5px solid black;
margin: 10px;
} -
34.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 170px;
padding: 5px;
border: 5px solid black;
margin: 0px;
} -
35.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 50px;
padding: 5px;
border: 1px solid black;
margin: 0px;
} -
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: 200px;
padding: 10px;
border: 2px solid black;
margin: 15px;
} -
37.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 270px;
padding: 10px;
border: 1px solid black;
margin: 0px;
} -
38.📦 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;
} -
39.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 110px;
padding: 20px;
border: 4px solid black;
margin: 10px;
} - 40.True or false: padding is the gap to other boxes. (a) True (b) False
Answer key
- the gap round content
- 328
- 268
- False
- 100
- 66
- 206
- True
- 122
- 210
- the line round the box
- 236
- 184
- the text or picture
- 172
- padding
- 92
- 346
- 276
- False
- margin
- 144
- 184
- False
- 182
- space outside the border
- 84
- 140
- border
- the gap to other boxes
- True
- 94
- 110
- 190
- 62
- 224
- 292
- 78
- 178
- False
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids