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: 290px;
padding: 5px;
border: 5px solid black;
margin: 5px;
} - 2.Which of these is the content? (a) space outside the border (b) the gap to other boxes (c) the gap round content (d) the text or picture
-
3.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 160px;
padding: 25px;
border: 1px solid black;
margin: 5px;
} - 4.📦 In the box model, which part is the line round the box? (a) content (b) border (c) margin (d) padding
-
5.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 120px;
padding: 10px;
border: 4px solid black;
margin: 10px;
} - 6.Which of these is padding? (a) a solid or dotted edge (b) space outside the border (c) the text or picture (d) space inside the border
-
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: 190px;
padding: 30px;
border: 5px solid black;
margin: 20px;
} -
8.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 40px;
padding: 5px;
border: 2px solid black;
margin: 5px;
} -
9.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 180px;
padding: 15px;
border: 3px solid black;
margin: 20px;
} - 10.True or false: the content is the gap to other boxes. (a) False (b) True
- 11.📦 In the box model, which part is the gap to other boxes? (a) margin (b) content (c) border (d) padding
- 12.True or false: the border is the line round the box. (a) True (b) False
-
13.📦 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: 2px solid black;
margin: 0px;
} - 14.Which of these is padding? (a) the gap to other boxes (b) the gap round content (c) the text or picture (d) the line round the box
- 15.True or false: padding is the gap round content. (a) True (b) False
-
16.📦 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: 25px;
border: 1px solid black;
margin: 5px;
} -
17.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 290px;
padding: 25px;
border: 2px solid black;
margin: 5px;
} -
18.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 100px;
padding: 10px;
border: 2px solid black;
margin: 10px;
} -
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: 150px;
padding: 20px;
border: 3px solid black;
margin: 10px;
} - 20.📦 In the box model, which part is space outside the border? (a) content (b) margin (c) border (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: 260px;
padding: 10px;
border: 5px solid black;
margin: 10px;
} - 22.📦 In the box model, which part is space inside the border? (a) border (b) padding (c) content (d) margin
- 23.True or false: margin is the gap to other boxes. (a) True (b) False
- 24.True or false: padding is space inside the border. (a) True (b) False
-
25.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 140px;
padding: 10px;
border: 5px solid black;
margin: 10px;
} - 26.📦 In the box model, which part is a solid or dotted edge? (a) margin (b) border (c) padding (d) content
- 27.True or false: the border is the gap round content. (a) True (b) False
-
28.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 130px;
padding: 10px;
border: 4px solid black;
margin: 10px;
} -
29.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 70px;
padding: 30px;
border: 5px solid black;
margin: 5px;
} -
30.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 190px;
padding: 25px;
border: 3px solid black;
margin: 10px;
} - 31.True or false: margin is the gap round content. (a) True (b) False
-
32.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 80px;
padding: 5px;
border: 5px solid black;
margin: 10px;
} - 33.Which of these is margin? (a) the text or picture (b) the gap to other boxes (c) the line round the box (d) the gap round content
-
34.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 290px;
padding: 5px;
border: 1px solid black;
margin: 10px;
} - 35.True or false: the border is space outside the border. (a) False (b) True
- 36.True or false: padding is a solid or dotted edge. (a) False (b) True
-
37.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 60px;
padding: 25px;
border: 4px solid black;
margin: 5px;
} -
38.📦 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: 15px;
border: 1px solid black;
margin: 10px;
} -
39.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 190px;
padding: 5px;
border: 4px solid black;
margin: 20px;
} -
40.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 100px;
padding: 10px;
border: 1px solid black;
margin: 15px;
}
Answer key
- 320
- the text or picture
- 222
- border
- 168
- space inside the border
- 260
- 64
- 216
- False
- margin
- True
- 144
- the gap round content
- True
- 162
- 354
- 144
- 196
- margin
- 290
- padding
- True
- True
- 190
- border
- False
- 178
- 140
- 246
- False
- 120
- the gap to other boxes
- 322
- False
- False
- 128
- 152
- 248
- 152
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids