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: 280px;
padding: 10px;
border: 3px solid black;
margin: 0px;
} -
2.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 190px;
padding: 10px;
border: 2px solid black;
margin: 15px;
} -
3.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 90px;
padding: 30px;
border: 4px solid black;
margin: 0px;
} - 4.True or false: padding is the gap to other boxes. (a) False (b) True
-
5.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 110px;
padding: 20px;
border: 2px solid black;
margin: 20px;
} -
6.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 50px;
padding: 10px;
border: 3px solid black;
margin: 0px;
} - 7.Which of these is the content? (a) space outside the border (b) the gap to other boxes (c) the text or picture (d) space inside the border
- 8.True or false: the border is a solid or dotted edge. (a) True (b) False
-
9.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 180px;
padding: 25px;
border: 5px 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: 200px;
padding: 20px;
border: 4px solid black;
margin: 20px;
} - 11.True or false: margin is the gap round content. (a) True (b) False
-
12.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 230px;
padding: 25px;
border: 5px solid black;
margin: 10px;
} - 13.True or false: the border is space inside the border. (a) True (b) False
- 14.Which of these is padding? (a) the text or picture (b) the line round the box (c) space outside the border (d) space inside the border
- 15.True or false: padding is the gap round content. (a) True (b) False
- 16.True or false: margin is the gap to other boxes. (a) False (b) True
-
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: 100px;
padding: 5px;
border: 4px solid black;
margin: 10px;
} - 18.True or false: the content is space outside the border. (a) True (b) False
- 19.📦 In the box model, which part is the gap round content? (a) border (b) margin (c) padding (d) content
- 20.Which of these is margin? (a) space inside the border (b) the text or picture (c) the gap round content (d) space outside the border
- 21.True or false: margin is the text or picture. (a) True (b) False
- 22.📦 In the box model, which part is space outside the border? (a) content (b) border (c) margin (d) padding
-
23.📦 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: 20px;
} - 24.Which of these is margin? (a) a solid or dotted edge (b) the gap to other boxes (c) the gap round content (d) space inside the border
- 25.📦 In the box model, which part is a solid or dotted edge? (a) content (b) margin (c) padding (d) border
-
26.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 80px;
padding: 25px;
border: 1px solid black;
margin: 0px;
} - 27.True or false: the border is the gap round content. (a) True (b) False
-
28.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 120px;
padding: 10px;
border: 2px solid black;
margin: 15px;
} - 29.Which of these is the border? (a) space inside the border (b) space outside the border (c) a solid or dotted edge (d) the gap to other boxes
- 30.📦 In the box model, which part is the text or picture? (a) border (b) content (c) padding (d) margin
- 31.Which of these is the border? (a) the line round the box (b) space inside the border (c) the gap round content (d) the gap to other boxes
-
32.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 100px;
padding: 5px;
border: 1px solid black;
margin: 10px;
} -
33.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 180px;
padding: 30px;
border: 5px solid black;
margin: 5px;
} - 34.📦 In the box model, which part is the gap to other boxes? (a) padding (b) margin (c) content (d) border
- 35.📦 In the box model, which part is space inside the border? (a) content (b) padding (c) border (d) margin
-
36.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 100px;
padding: 5px;
border: 5px solid black;
margin: 0px;
} -
37.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 150px;
padding: 15px;
border: 2px solid black;
margin: 20px;
} -
38.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 120px;
padding: 10px;
border: 2px solid black;
margin: 0px;
} -
39.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 140px;
padding: 25px;
border: 2px solid black;
margin: 0px;
} -
40.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 200px;
padding: 30px;
border: 2px solid black;
margin: 0px;
}
Answer key
- 306
- 244
- 158
- False
- 194
- 76
- the text or picture
- True
- 260
- 248
- False
- 310
- False
- space inside the border
- True
- True
- 118
- False
- padding
- space outside the border
- False
- margin
- 276
- the gap to other boxes
- border
- 132
- False
- 174
- a solid or dotted edge
- content
- the line round the box
- 132
- 260
- margin
- padding
- 120
- 224
- 144
- 194
- 264
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids