CSS Worksheet: Practice Test
Code tip (Rule, then maths): Find the topic: syntax, selectors, properties, colours, box model, cascade, flexbox or media queries. Decide which rule or property applies to the element. For sizes, write the sum down: both sides for the box model, free space for flexbox.
NameDateTime takenScore ___ / 40
- 1.🌈 In #rrggbb, which colour do the first two digits give? (a) blue (b) black (c) red (d) green
-
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: 240px;
padding: 30px;
border: 4px solid black;
margin: 0px;
} - 3.🌈 Which colour of light is strongest in rgb(25, 57, 188)? (a) blue (b) green (c) red
-
4.✍️ What value is given to margin in this rule?
h1 {
margin: 10px;
background-color: yellow;
font-style: italic;
} (a) bold (b) margin (c) 8px (d) 10px - 5.🖌️ Which CSS property makes the text bold? (a) color (b) font-weight (c) text-align (d) font-family
- 6.Which of these is margin? (a) the text or picture (b) space outside the border (c) the gap round content (d) space inside the border
-
7.🖌️ How big is the text, in px?
p {
background-color: purple;
text-align: left;
color: white;
font-size: 28px;
} -
8.🖌️ Where does the text sit on its line?
li {
background-color: green;
font-size: 40px;
text-align: left;
color: orange;
} (a) on the right (b) on the left (c) in the middle - 9.🌈 Which hex code is white? (a) #ffff00 (b) #000000 (c) #0000ff (d) #ffffff
- 10.🖌️ Which CSS property makes letters bigger? (a) font-family (b) color (c) font-weight (d) font-size
-
11.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 80px;
padding: 20px;
border: 4px solid black;
margin: 0px;
} - 12.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) the first one (c) neither (d) the later one
- 13.🖌️ Which CSS property centres a heading? (a) background-color (b) font-family (c) text-align (d) font-weight
- 14.True or false: HTML checks a quiz answer. (a) False (b) True
-
15.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 240px;
justify-content: center;
}
Inside are 2 boxes, each 60px wide (no margins). - 16.True or false: .card is a class selector. (a) True (b) False
- 17.💪 Which justify-content value packs boxes at the start? (a) space-between (b) center (c) flex-start (d) flex-end
-
18.✍️ What value is given to font-weight in this rule?
body {
margin: 10px;
font-size: 20px;
font-weight: bold;
} (a) font-weight (b) 2px solid (c) 300px (d) bold -
19.🖌️ What colour are the letters?
li {
background-color: white;
color: yellow;
text-align: left;
font-size: 20px;
} (a) white (b) yellow (c) blue - 20.🎯 Which sign starts a class selector? (a) @ (b) . (c) & (d) #
- 21.True or false: HTML gives the page structure. (a) True (b) False
- 22.🖌️ Which CSS property colours behind the text? (a) font-family (b) background-color (c) font-size (d) color
-
23.⚖️ What colour is the text of this element?
<p class="box" id="logo">Hi</p>
CSS:
p { color: blue; }
p { color: green; } (a) blue (b) red (c) green (d) purple -
24.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (min-width: 600px) {
p {
font-size: 22px;
}
} - 25.🌈 Which hex code is blue? (a) #0000ff (b) #ffff00 (c) #ffffff (d) #00ffff
- 26.📦 In the box model, which part is a solid or dotted edge? (a) margin (b) content (c) border (d) padding
- 27.🎯 Which element does the selector li style? (a) <p id="hero"> (b) <span class="menu"> (c) <div> (d) <li class="menu">
- 28.🌈 Which colour is rgb(255, 0, 0)? (a) yellow (b) bright green (c) red (d) cyan
-
29.🖌️ What colour are the letters?
h2 {
color: green;
text-align: center;
background-color: purple;
font-size: 40px;
} (a) yellow (b) purple (c) green -
30.✍️ How many declarations (property: value pairs) are in this rule?
.note {
width: 300px;
border: 2px solid;
font-size: 20px;
font-weight: bold;
} -
31.🎯 Which CSS selector matches this element?
<p class="note" id="main">Hello</p> (a) .main (b) #main (c) h1 (d) #logo - 32.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 6 (b) 4 (c) 2 (d) 3
-
33.✍️ What value is given to font-size in this rule?
li {
font-size: 20px;
font-style: italic;
border: 2px solid;
} (a) font-size (b) 20px (c) yellow (d) center - 34.📱 min-width: 800px applies when the screen is ___. (a) exactly 100px (b) 800px or narrower (c) turned off (d) 800px or wider
-
35.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 360px;
justify-content: flex-end;
}
Inside are 4 boxes, each 80px wide (no margins). -
36.✍️ What is the selector in this CSS rule?
li {
font-style: italic;
text-align: center;
border: 2px solid;
margin: 10px;
} (a) font-style (b) body (c) li (d) center -
37.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 170px;
justify-content: flex-start;
}
Inside are 3 boxes, each 40px wide (no margins). -
38.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 1024px) {
p {
font-size: 24px;
}
} -
39.🖌️ How big is the text, in px?
p {
text-align: left;
color: white;
font-size: 36px;
background-color: blue;
} - 40.✍️ Which sign goes between a property and its value? (a) ; (b) - (c) : (d) =
Answer key
- red
- 308
- blue
- 10px
- font-weight
- space outside the border
- 28
- on the left
- #ffffff
- font-size
- 128
- the later one
- text-align
- False
- 60
- True
- flex-start
- bold
- yellow
- .
- True
- background-color
- green
- 20
- #0000ff
- border
- <li class="menu">
- red
- green
- 4
- #main
- 3
- 20px
- 800px or wider
- 40
- li
- 50
- 16
- 36
- :
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids