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 across (px) does this box take in all, margin included?
.box {
width: 100px;
padding: 10px;
border: 2px solid black;
margin: 20px;
} -
2.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 200px;
padding: 10px;
border: 3px solid black;
margin: 15px;
} - 3.📦 In the box model, which part is space outside the border? (a) padding (b) margin (c) content (d) border
- 4.📦 In the box model, which part is the gap round content? (a) border (b) content (c) padding (d) margin
- 5.True or false: padding is the line round the box. (a) False (b) True
- 6.True or false: padding is space outside the border. (a) True (b) False
- 7.Which of these is padding? (a) the text or picture (b) the gap round content (c) space outside the border (d) the gap to other boxes
- 8.Which of these is the border? (a) the gap to other boxes (b) the gap round content (c) a solid or dotted edge (d) space inside the border
- 9.Which of these is margin? (a) a solid or dotted edge (b) space outside the border (c) space inside the border (d) the gap round content
-
10.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 280px;
padding: 10px;
border: 5px solid black;
margin: 15px;
} -
11.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 130px;
padding: 20px;
border: 4px solid black;
margin: 0px;
} -
12.📦 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: 10px;
border: 3px solid black;
margin: 10px;
} - 13.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
-
14.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 220px;
padding: 10px;
border: 2px solid black;
margin: 5px;
} - 15.True or false: margin is the gap round content. (a) False (b) True
- 16.📦 In the box model, which part is the gap to other boxes? (a) padding (b) margin (c) content (d) border
-
17.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 300px;
padding: 5px;
border: 5px solid black;
margin: 15px;
} -
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: 230px;
padding: 10px;
border: 5px solid black;
margin: 0px;
} -
19.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 40px;
padding: 10px;
border: 1px solid black;
margin: 10px;
} - 20.📦 In the box model, which part is space inside the border? (a) margin (b) content (c) padding (d) border
-
21.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 40px;
padding: 15px;
border: 2px solid black;
margin: 20px;
} - 22.True or false: the border is the line round the box. (a) True (b) False
-
23.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 240px;
padding: 30px;
border: 3px solid black;
margin: 5px;
} - 24.Which of these is the border? (a) space inside the border (b) the gap round content (c) the gap to other boxes (d) the line round the box
-
25.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 240px;
padding: 30px;
border: 1px solid black;
margin: 15px;
} -
26.📦 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: 25px;
border: 5px solid black;
margin: 0px;
} -
27.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 180px;
padding: 10px;
border: 4px solid black;
margin: 0px;
} - 28.True or false: margin is space inside the border. (a) True (b) False
- 29.True or false: padding is the text or picture. (a) True (b) False
- 30.📦 In the box model, which part is the text or picture? (a) margin (b) padding (c) border (d) content
- 31.Which of these is the content? (a) the gap round content (b) space inside the border (c) the line round the box (d) the text or picture
- 32.📦 In the box model, which part is the line round the box? (a) margin (b) padding (c) border (d) content
- 33.True or false: margin is the gap to other boxes. (a) False (b) True
-
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: 110px;
padding: 20px;
border: 3px solid black;
margin: 0px;
} -
35.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 270px;
padding: 10px;
border: 2px solid black;
margin: 0px;
} -
36.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 110px;
padding: 5px;
border: 2px solid black;
margin: 0px;
} -
37.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 200px;
padding: 20px;
border: 4px solid black;
margin: 5px;
} - 38.True or false: the content is the text or picture. (a) True (b) False
- 39.True or false: padding is space inside the border. (a) True (b) False
-
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: 60px;
padding: 20px;
border: 2px solid black;
margin: 20px;
}
Answer key
- 164
- 256
- margin
- padding
- False
- False
- the gap round content
- a solid or dotted edge
- space outside the border
- 340
- 178
- 266
- the gap to other boxes
- 254
- False
- margin
- 350
- 260
- 82
- padding
- 114
- True
- 316
- the line round the box
- 332
- 350
- 208
- False
- False
- content
- the text or picture
- border
- True
- 156
- 294
- 124
- 258
- True
- True
- 104
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids