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: 5px;
border: 4px solid black;
margin: 15px;
} - 2.Which of these is padding? (a) the line round the box (b) the text or picture (c) a solid or dotted edge (d) space inside the border
- 3.Which of these is padding? (a) the line round the box (b) the text or picture (c) the gap round content (d) a solid or dotted edge
-
4.📦 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: 10px;
border: 3px solid black;
margin: 10px;
} - 5.Which of these is the content? (a) a solid or dotted edge (b) the text or picture (c) space outside the border (d) space inside the border
- 6.📦 In the box model, which part is the line round the box? (a) margin (b) content (c) padding (d) border
-
7.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 110px;
padding: 30px;
border: 4px solid black;
margin: 20px;
} - 8.Which of these is the border? (a) the gap round content (b) the text or picture (c) space inside the border (d) a solid or dotted edge
- 9.True or false: the content is space outside the border. (a) False (b) True
-
10.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 80px;
padding: 30px;
border: 2px solid black;
margin: 5px;
} -
11.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 250px;
padding: 25px;
border: 2px solid black;
margin: 20px;
} - 12.True or false: padding is the line round the box. (a) False (b) True
-
13.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 90px;
padding: 5px;
border: 5px solid black;
margin: 0px;
} -
14.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 220px;
padding: 30px;
border: 5px solid black;
margin: 5px;
} - 15.True or false: the border is the gap to other boxes. (a) True (b) False
-
16.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 60px;
padding: 30px;
border: 1px solid black;
margin: 0px;
} - 17.Which of these is margin? (a) space outside the border (b) the gap round content (c) the text or picture (d) the line round the box
- 18.Which of these is the border? (a) the gap round content (b) space inside the border (c) the line round the box (d) the text or picture
-
19.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 130px;
padding: 20px;
border: 1px solid black;
margin: 0px;
} -
20.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 120px;
padding: 30px;
border: 5px solid black;
margin: 5px;
} -
21.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 210px;
padding: 15px;
border: 4px solid black;
margin: 15px;
} -
22.📦 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: 5px;
} - 23.True or false: margin is the gap to other boxes. (a) False (b) True
-
24.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 220px;
padding: 30px;
border: 2px solid black;
margin: 10px;
} - 25.Which of these is margin? (a) space inside the border (b) a solid or dotted edge (c) the gap to other boxes (d) the text or picture
- 26.📦 In the box model, which part is the text or picture? (a) padding (b) margin (c) border (d) content
-
27.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 50px;
padding: 10px;
border: 5px solid black;
margin: 0px;
} -
28.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 300px;
padding: 20px;
border: 5px solid black;
margin: 20px;
} - 29.True or false: margin is the text or picture. (a) False (b) True
-
30.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 40px;
padding: 10px;
border: 5px solid black;
margin: 20px;
} - 31.True or false: the border is the line round the box. (a) False (b) True
- 32.True or false: padding is space outside the border. (a) False (b) True
-
33.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 170px;
padding: 5px;
border: 5px solid black;
margin: 0px;
} - 34.True or false: margin is space outside the border. (a) True (b) False
-
35.📦 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: 30px;
border: 3px solid black;
margin: 10px;
} - 36.True or false: padding is the gap round content. (a) False (b) True
-
37.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 100px;
padding: 20px;
border: 1px solid black;
margin: 10px;
} -
38.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 150px;
padding: 20px;
border: 1px solid black;
margin: 0px;
} -
39.📦 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: 5px;
border: 1px solid black;
margin: 0px;
} -
40.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 50px;
padding: 20px;
border: 3px solid black;
margin: 15px;
}
Answer key
- 168
- space inside the border
- the gap round content
- 146
- the text or picture
- border
- 218
- a solid or dotted edge
- False
- 154
- 344
- False
- 110
- 300
- False
- 122
- space outside the border
- the line round the box
- 172
- 200
- 278
- 210
- True
- 304
- the gap to other boxes
- content
- 80
- 390
- False
- 110
- True
- False
- 190
- True
- 236
- True
- 162
- 192
- 142
- 126
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids