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: 120px;
padding: 30px;
border: 1px solid black;
margin: 15px;
} -
2.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 180px;
padding: 30px;
border: 5px solid black;
margin: 10px;
} - 3.📦 In the box model, which part is space inside the border? (a) margin (b) padding (c) content (d) border
-
4.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 40px;
padding: 15px;
border: 3px solid black;
margin: 10px;
} - 5.True or false: padding is the text or picture. (a) True (b) False
-
6.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 50px;
padding: 10px;
border: 2px solid black;
margin: 10px;
} -
7.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 300px;
padding: 5px;
border: 5px solid black;
margin: 15px;
} -
8.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 50px;
padding: 25px;
border: 2px solid black;
margin: 15px;
} - 9.True or false: margin is the text or picture. (a) False (b) True
- 10.📦 In the box model, which part is the gap to other boxes? (a) padding (b) border (c) content (d) margin
-
11.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 80px;
padding: 10px;
border: 3px solid black;
margin: 0px;
} -
12.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 190px;
padding: 15px;
border: 3px solid black;
margin: 10px;
} - 13.Which of these is the border? (a) the text or picture (b) the gap round content (c) space outside the border (d) the line round the box
-
14.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 140px;
padding: 25px;
border: 2px solid black;
margin: 15px;
} - 15.Which of these is the border? (a) the text or picture (b) space inside the border (c) a solid or dotted edge (d) space outside the border
- 16.True or false: the content is the text or picture. (a) False (b) True
-
17.📦 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: 5px;
} - 18.True or false: padding is the gap round content. (a) False (b) True
- 19.True or false: the content is space inside the border. (a) True (b) False
- 20.📦 In the box model, which part is the text or picture? (a) border (b) margin (c) content (d) padding
-
21.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 50px;
padding: 10px;
border: 2px solid black;
margin: 15px;
} -
22.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 40px;
padding: 20px;
border: 4px solid black;
margin: 15px;
} - 23.Which of these is margin? (a) space outside the border (b) a solid or dotted edge (c) the text or picture (d) space inside the border
-
24.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 220px;
padding: 15px;
border: 2px solid black;
margin: 10px;
} -
25.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 140px;
padding: 25px;
border: 5px solid black;
margin: 0px;
} -
26.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 110px;
padding: 15px;
border: 5px solid black;
margin: 10px;
} -
27.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 90px;
padding: 20px;
border: 1px solid black;
margin: 20px;
} - 28.True or false: margin is the gap round content. (a) False (b) True
- 29.Which of these is padding? (a) space inside the border (b) the text or picture (c) the gap to other boxes (d) a solid or dotted edge
- 30.True or false: the content is a solid or dotted edge. (a) True (b) False
-
31.📦 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: 5px;
border: 2px solid black;
margin: 5px;
} -
32.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 200px;
padding: 25px;
border: 2px solid black;
margin: 10px;
} -
33.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 90px;
padding: 20px;
border: 3px solid black;
margin: 5px;
} - 34.Which of these is padding? (a) a solid or dotted edge (b) the line round the box (c) the gap round content (d) the gap to other boxes
- 35.📦 In the box model, which part is a solid or dotted edge? (a) padding (b) content (c) border (d) margin
- 36.True or false: the border is the gap round content. (a) True (b) False
- 37.True or false: the border is a solid or dotted edge. (a) True (b) False
- 38.True or false: padding is the gap to other boxes. (a) True (b) False
-
39.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 150px;
padding: 5px;
border: 3px solid black;
margin: 0px;
} - 40.True or false: the content is the gap to other boxes. (a) True (b) False
Answer key
- 212
- 270
- padding
- 96
- False
- 94
- 350
- 104
- False
- margin
- 106
- 246
- the line round the box
- 224
- a solid or dotted edge
- True
- 154
- True
- False
- content
- 74
- 118
- space outside the border
- 274
- 200
- 170
- 172
- False
- space inside the border
- False
- 134
- 274
- 146
- the gap round content
- border
- False
- True
- False
- 166
- False
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids