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.⚖️ What colour is the text of this element?
<h1 class="red" id="hero">Hi</h1>
CSS:
#hero { color: red; }
#hero { color: white; } (a) white (b) blue (c) purple (d) red -
2.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (max-width: 480px) {
p {
font-size: 20px;
}
} - 3.🔍 Which is the odd one out? (a) counts down a timer (b) shows a pop-up message (c) sets colours and fonts (d) checks a quiz answer
-
4.📱 The screen is 820px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (min-width: 600px) {
p {
font-size: 22px;
}
} (a) No (b) Yes - 5.📱 min-width: 800px applies when the screen is ___. (a) turned off (b) 800px or wider (c) exactly 100px (d) 800px or narrower
- 6.⚖️ Which selector is the strongest? (a) an element selector (b) a class selector (c) an id selector
- 7.True or false: CSS counts down a timer. (a) False (b) True
- 8.🌈 Which colour is rgb(255, 255, 0)? (a) yellow (b) cyan (c) bright green (d) red
- 9.📱 Which tag helps phones show a page at the right size? (a) the hr tag (b) the title tag (c) the br tag (d) the viewport meta tag
-
10.⚖️ What colour is the text of this element?
<p class="big" id="intro">Hi</p>
CSS:
.big { color: red; }
#intro { color: green; }
p { color: blue; } (a) purple (b) green (c) blue (d) red -
11.⚖️ What colour is the text of this element?
<h2 class="star" id="hero">Hi</h2>
CSS:
#hero { color: blue; }
#hero { color: red; } (a) red (b) yellow (c) blue (d) white - 12.🖌️ Which CSS property centres a heading? (a) color (b) font-size (c) font-weight (d) text-align
-
13.✍️ Which property is set to 300px in this rule?
h2 {
width: 300px;
font-size: 20px;
} (a) font-style (b) color (c) width (d) 300px - 14.🌈 Which hex code is red? (a) #ff0000 (b) #0000ff (c) #00ffff (d) #00ff00
-
15.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 40px;
padding: 25px;
border: 1px solid black;
margin: 0px;
} -
16.🖌️ What colour are the letters?
h1 {
text-align: right;
background-color: white;
font-size: 32px;
color: purple;
} (a) yellow (b) white (c) purple - 17.🌈 Which colour is rgb(0, 255, 0)? (a) white (b) red (c) blue (d) bright green
-
18.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 170px;
padding: 15px;
border: 2px solid black;
margin: 15px;
} -
19.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 240px;
justify-content: flex-start;
}
Inside are 2 boxes, each 100px wide (no margins). - 20.🌈 Which hex code is black? (a) #00ff00 (b) #ff0000 (c) #000000 (d) #ffffff
-
21.⚖️ What colour is the text of this element?
<p class="note" id="intro">Hi</p>
CSS:
#intro { color: black; }
#intro { color: yellow; } (a) purple (b) black (c) yellow (d) green -
22.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 768px) {
p {
font-size: 14px;
}
} - 23.🌈 Which colour is rgb(255, 0, 255)? (a) red (b) magenta (c) white (d) bright green
- 24.💪 Which flexbox property spaces boxes along a row? (a) display: flex (b) gap (c) align-items (d) justify-content
- 25.🎯 Can many elements share the same class? (a) Yes (b) No
-
26.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 300px;
justify-content: flex-start;
}
Inside are 3 boxes, each 80px wide (no margins). -
27.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 150px;
justify-content: flex-end;
}
Inside are 2 boxes, each 60px wide (no margins). - 28.🖌️ Which CSS property makes letters bigger? (a) font-size (b) text-align (c) color (d) font-family
- 29.🌈 Which hex code is blue? (a) #ffff00 (b) #ffffff (c) #0000ff (d) #000000
- 30.🌈 Which hex code is yellow? (a) #ffff00 (b) #ff0000 (c) #ff00ff (d) #0000ff
-
31.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (min-width: 480px) {
p {
font-size: 26px;
}
} -
32.🖌️ Where does the text sit on its line?
h2 {
background-color: black;
font-size: 12px;
color: red;
text-align: center;
} (a) on the right (b) on the left (c) in the middle -
33.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 170px;
justify-content: flex-start;
}
Inside are 4 boxes, each 40px wide (no margins). - 34.🎯 What kind of selector is #top? (a) an id selector (b) a class selector (c) an element selector
-
35.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (min-width: 1024px) {
p {
font-size: 14px;
}
} -
36.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 768px) {
p {
font-size: 10px;
}
} - 37.True or false: JavaScript changes the page live. (a) True (b) False
- 38.🎯 What kind of selector is p? (a) an id selector (b) an element selector (c) a class selector
- 39.True or false: HTML checks a quiz answer. (a) True (b) False
- 40.🌈 Which colour is #00ff00? (a) red (b) magenta (c) bright green (d) white
Answer key
- white
- 24
- sets colours and fonts
- Yes
- 800px or wider
- an id selector
- False
- yellow
- the viewport meta tag
- green
- red
- text-align
- width
- #ff0000
- 92
- purple
- bright green
- 234
- 40
- #000000
- yellow
- 16
- magenta
- justify-content
- Yes
- 60
- 30
- font-size
- #0000ff
- #ffff00
- 20
- in the middle
- 10
- an id selector
- 12
- 10
- True
- an element selector
- False
- bright green
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids