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 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: 3px 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: 220px;
padding: 5px;
border: 2px solid black;
margin: 20px;
} - 3.True or false: padding is the gap round content. (a) False (b) True
- 4.True or false: margin is a solid or dotted edge. (a) True (b) False
-
5.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 90px;
padding: 15px;
border: 1px solid black;
margin: 0px;
} - 6.Which of these is margin? (a) the text or picture (b) space inside the border (c) space outside the border (d) the line round the box
- 7.📦 In the box model, which part is space outside the border? (a) border (b) margin (c) padding (d) content
-
8.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 140px;
padding: 15px;
border: 1px solid black;
margin: 20px;
} -
9.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 150px;
padding: 10px;
border: 2px solid black;
margin: 10px;
} - 10.Which of these is the border? (a) space outside the border (b) the line round the box (c) the gap to other boxes (d) the gap round content
-
11.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 100px;
padding: 25px;
border: 2px solid black;
margin: 0px;
} - 12.Which of these is the content? (a) the line round the box (b) the text or picture (c) space inside the border (d) the gap round content
- 13.True or false: the content is the text or picture. (a) True (b) False
- 14.Which of these is padding? (a) space outside the border (b) a solid or dotted edge (c) space inside the border (d) the gap to other boxes
-
15.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 150px;
padding: 30px;
border: 2px solid black;
margin: 5px;
} - 16.📦 In the box model, which part is the text or picture? (a) margin (b) content (c) padding (d) border
-
17.📦 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: 5px solid black;
margin: 5px;
} - 18.📦 In the box model, which part is space inside the border? (a) margin (b) padding (c) content (d) border
-
19.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 190px;
padding: 5px;
border: 4px solid black;
margin: 0px;
} -
20.📦 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: 15px;
border: 1px solid black;
margin: 10px;
} - 21.True or false: padding is the text or picture. (a) True (b) False
-
22.📦 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: 0px;
} - 23.True or false: padding is the line round the box. (a) False (b) True
-
24.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 40px;
padding: 5px;
border: 5px solid black;
margin: 20px;
} - 25.Which of these is margin? (a) the line round the box (b) space inside the border (c) the text or picture (d) the gap to other boxes
- 26.📦 In the box model, which part is the gap round content? (a) padding (b) content (c) margin (d) border
-
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: 230px;
padding: 25px;
border: 2px solid black;
margin: 5px;
} -
28.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 130px;
padding: 5px;
border: 3px solid black;
margin: 20px;
} -
29.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 70px;
padding: 30px;
border: 2px solid black;
margin: 0px;
} -
30.📦 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: 30px;
border: 1px solid black;
margin: 0px;
} -
31.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 90px;
padding: 5px;
border: 3px solid black;
margin: 10px;
} -
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: 120px;
padding: 25px;
border: 1px solid black;
margin: 0px;
} -
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: 290px;
padding: 10px;
border: 1px solid black;
margin: 15px;
} -
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: 190px;
padding: 5px;
border: 5px solid black;
margin: 10px;
} - 35.True or false: the border is the gap round content. (a) True (b) False
-
36.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 140px;
padding: 10px;
border: 4px solid black;
margin: 20px;
} -
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: 80px;
padding: 25px;
border: 1px solid black;
margin: 0px;
} -
38.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 50px;
padding: 30px;
border: 5px solid black;
margin: 5px;
} -
39.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 220px;
padding: 30px;
border: 3px solid black;
margin: 15px;
} -
40.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 90px;
padding: 25px;
border: 2px solid black;
margin: 5px;
}
Answer key
- 186
- 234
- True
- False
- 122
- space outside the border
- margin
- 212
- 194
- the line round the box
- 154
- the text or picture
- True
- space inside the border
- 224
- content
- 240
- padding
- 208
- 242
- False
- 68
- False
- 100
- the gap to other boxes
- padding
- 284
- 186
- 134
- 212
- 126
- 172
- 312
- 210
- False
- 208
- 132
- 130
- 316
- 144
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids