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: 240px;
padding: 5px;
border: 2px solid black;
margin: 10px;
} -
2.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 130px;
padding: 5px;
border: 2px solid black;
margin: 5px;
} - 3.True or false: padding is a solid or dotted edge. (a) True (b) False
-
4.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 230px;
padding: 30px;
border: 1px solid black;
margin: 0px;
} - 5.Which of these is the content? (a) the text or picture (b) space outside the border (c) space inside the border (d) a solid or dotted edge
-
6.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 40px;
padding: 30px;
border: 3px solid black;
margin: 15px;
} -
7.📦 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: 4px solid black;
margin: 20px;
} - 8.Which of these is margin? (a) the gap to other boxes (b) the text or picture (c) the line round the box (d) space inside the border
-
9.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 100px;
padding: 20px;
border: 1px solid black;
margin: 15px;
} -
10.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 100px;
padding: 5px;
border: 4px solid black;
margin: 20px;
} -
11.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 50px;
padding: 15px;
border: 3px solid black;
margin: 0px;
} -
12.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 260px;
padding: 5px;
border: 3px solid black;
margin: 10px;
} -
13.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 180px;
padding: 15px;
border: 1px solid black;
margin: 15px;
} - 14.True or false: margin is space inside the border. (a) True (b) False
-
15.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 270px;
padding: 20px;
border: 4px solid black;
margin: 10px;
} - 16.Which of these is the border? (a) the gap round content (b) the text or picture (c) a solid or dotted edge (d) space inside the border
- 17.📦 In the box model, which part is a solid or dotted edge? (a) padding (b) border (c) content (d) margin
-
18.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 60px;
padding: 10px;
border: 4px solid black;
margin: 15px;
} -
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: 300px;
padding: 10px;
border: 5px solid black;
margin: 15px;
} -
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: 170px;
padding: 25px;
border: 4px solid black;
margin: 20px;
} - 21.True or false: padding is space inside the border. (a) False (b) True
- 22.True or false: the content is the line round the box. (a) True (b) False
-
23.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 70px;
padding: 25px;
border: 4px solid black;
margin: 20px;
} -
24.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 220px;
padding: 10px;
border: 3px solid black;
margin: 15px;
} -
25.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 110px;
padding: 5px;
border: 4px solid black;
margin: 15px;
} -
26.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 100px;
padding: 30px;
border: 4px solid black;
margin: 10px;
} -
27.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 80px;
padding: 30px;
border: 1px solid black;
margin: 15px;
} -
28.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 190px;
padding: 20px;
border: 3px solid black;
margin: 15px;
} - 29.True or false: the content is space outside the border. (a) True (b) False
- 30.Which of these is margin? (a) a solid or dotted edge (b) the gap round content (c) space outside the border (d) space inside the border
- 31.📦 In the box model, which part is the text or picture? (a) padding (b) border (c) margin (d) content
- 32.True or false: the content is space inside the border. (a) False (b) True
-
33.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 80px;
padding: 5px;
border: 4px solid black;
margin: 10px;
} - 34.True or false: the content is the text or picture. (a) False (b) True
-
35.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 60px;
padding: 25px;
border: 2px solid black;
margin: 5px;
} - 36.True or false: padding is space outside the border. (a) False (b) True
-
37.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 120px;
padding: 20px;
border: 2px solid black;
margin: 15px;
} - 38.📦 In the box model, which part is the line round the box? (a) margin (b) border (c) content (d) padding
-
39.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 230px;
padding: 30px;
border: 4px solid black;
margin: 0px;
} - 40.True or false: margin is space outside the border. (a) False (b) True
Answer key
- 254
- 154
- False
- 292
- the text or picture
- 136
- 208
- the gap to other boxes
- 172
- 158
- 86
- 296
- 242
- False
- 338
- a solid or dotted edge
- border
- 118
- 330
- 228
- True
- False
- 168
- 276
- 158
- 188
- 172
- 266
- False
- space outside the border
- content
- False
- 118
- True
- 124
- False
- 194
- border
- 298
- True
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids