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: 290px;
padding: 10px;
border: 5px solid black;
margin: 15px;
} -
2.📦 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: 20px;
border: 4px solid black;
margin: 20px;
} -
3.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 210px;
padding: 15px;
border: 1px solid black;
margin: 15px;
} - 4.📦 In the box model, which part is a solid or dotted edge? (a) padding (b) border (c) margin (d) content
- 5.📦 In the box model, which part is space inside the border? (a) content (b) padding (c) border (d) margin
- 6.📦 In the box model, which part is space outside the border? (a) border (b) padding (c) content (d) margin
-
7.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 90px;
padding: 20px;
border: 2px solid black;
margin: 15px;
} -
8.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 50px;
padding: 5px;
border: 2px solid black;
margin: 20px;
} - 9.True or false: the border is the gap to other boxes. (a) False (b) True
- 10.Which of these is margin? (a) the line round the box (b) space outside the border (c) a solid or dotted edge (d) the text or picture
- 11.📦 In the box model, which part is the gap round content? (a) padding (b) margin (c) content (d) border
-
12.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 260px;
padding: 25px;
border: 5px solid black;
margin: 10px;
} -
13.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 160px;
padding: 20px;
border: 3px solid black;
margin: 0px;
} - 14.True or false: margin is the line round the box. (a) True (b) False
-
15.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 110px;
padding: 30px;
border: 5px solid black;
margin: 15px;
} -
16.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 260px;
padding: 25px;
border: 3px solid black;
margin: 0px;
} - 17.True or false: the border is the line round the box. (a) True (b) False
-
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: 70px;
padding: 30px;
border: 3px solid black;
margin: 0px;
} - 19.True or false: margin is space outside the border. (a) True (b) False
- 20.Which of these is the border? (a) the gap to other boxes (b) space inside the border (c) the gap round content (d) a solid or dotted edge
- 21.True or false: the content is the text or picture. (a) False (b) True
-
22.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 280px;
padding: 20px;
border: 4px solid black;
margin: 5px;
} -
23.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 120px;
padding: 15px;
border: 5px solid black;
margin: 0px;
} - 24.True or false: padding is the gap to other boxes. (a) False (b) True
- 25.True or false: margin is the text or picture. (a) True (b) False
- 26.Which of these is padding? (a) the line round the box (b) the gap to other boxes (c) the text or picture (d) space inside the border
-
27.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 190px;
padding: 15px;
border: 5px solid black;
margin: 0px;
} - 28.📦 In the box model, which part is the gap to other boxes? (a) margin (b) padding (c) border (d) content
-
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: 280px;
padding: 5px;
border: 3px solid black;
margin: 10px;
} -
30.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 70px;
padding: 30px;
border: 1px solid black;
margin: 10px;
} -
31.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 180px;
padding: 10px;
border: 3px solid black;
margin: 0px;
} -
32.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 70px;
padding: 30px;
border: 1px solid black;
margin: 20px;
} -
33.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 260px;
padding: 5px;
border: 4px solid black;
margin: 0px;
} -
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: 250px;
padding: 5px;
border: 3px solid black;
margin: 20px;
} -
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: 50px;
padding: 30px;
border: 2px solid black;
margin: 0px;
} - 36.Which of these is the content? (a) the gap to other boxes (b) a solid or dotted edge (c) the line round the box (d) the text or picture
- 37.True or false: padding is the gap round content. (a) True (b) False
-
38.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 180px;
padding: 5px;
border: 4px solid black;
margin: 5px;
} -
39.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 200px;
padding: 15px;
border: 3px solid black;
margin: 5px;
} - 40.True or false: the content is space inside the border. (a) True (b) False
Answer key
- 320
- 98
- 242
- border
- padding
- margin
- 164
- 104
- False
- space outside the border
- padding
- 340
- 206
- False
- 210
- 316
- True
- 136
- True
- a solid or dotted edge
- True
- 338
- 160
- False
- False
- space inside the border
- 230
- margin
- 296
- 152
- 206
- 172
- 278
- 266
- 114
- the text or picture
- True
- 208
- 246
- False
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids