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.🌈 Which hex code is black? (a) #00ffff (b) #00ff00 (c) #ff0000 (d) #000000
-
2.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (min-width: 480px) {
p {
font-size: 28px;
}
} (a) Yes (b) No -
3.✍️ Which property is set to 10px in this rule?
p {
text-align: center;
font-weight: bold;
margin: 10px;
} (a) padding (b) font-weight (c) 10px (d) margin - 4.🎯 Which element does the selector h2 style? (a) <div class="box"> (b) <h2 class="box"> (c) <span id="logo"> (d) <li>
- 5.🌈 Which colour is #ff0000? (a) yellow (b) red (c) white (d) magenta
- 6.✍️ Which sign ends each CSS declaration? (a) , (b) : (c) . (d) ;
- 7.True or false: JavaScript lays out the page. (a) False (b) True
-
8.🖌️ How big is the text, in px?
h1 {
background-color: black;
font-size: 32px;
text-align: left;
color: orange;
} - 9.🌈 Which hex code is cyan? (a) #ffff00 (b) #ffffff (c) #00ff00 (d) #00ffff
- 10.🎯 Which sign starts a class selector? (a) @ (b) . (c) & (d) #
-
11.⚖️ What colour is the text of this element?
<p class="menu" id="intro">Hi</p>
CSS:
.menu { color: purple; }
.menu { color: white; } (a) orange (b) white (c) purple (d) blue - 12.🖌️ Which CSS property colours behind the text? (a) color (b) text-align (c) font-family (d) background-color
- 13.True or false: body is an element selector. (a) False (b) True
- 14.🌈 Which colour is rgb(255, 255, 0)? (a) yellow (b) cyan (c) red (d) bright green
-
15.⚖️ What colour is the text of this element?
<h1 class="red" id="top">Hi</h1>
CSS:
h1 { color: purple; }
.red { color: white; }
#top { color: blue; } (a) yellow (b) white (c) blue (d) purple - 16.What does justify-content: space-between do? (a) packs boxes at the end (b) equal gaps, none at ends (c) puts boxes in the middle (d) packs boxes at the start
- 17.🔍 Which is the odd one out? (a) changes the text size (b) adds space around boxes (c) sets colours and fonts (d) puts a picture on a page
-
18.🎯 Which CSS selector matches this element?
<h2 class="star" id="top">Hello</h2> (a) li (b) #intro (c) h2 (d) .menu -
19.✍️ How many declarations (property: value pairs) are in this rule?
#top {
font-size: 20px;
} - 20.🌈 In #000043 the blue part is the hex number 43. What is it as a normal number?
- 21.🧩 Which language checks a quiz answer? (a) CSS (b) HTML (c) JavaScript
- 22.True or false: CSS makes headings and lists. (a) False (b) True
-
23.⚖️ What colour is the text of this element?
<p class="star" id="intro">Hi</p>
CSS:
.star { color: red; }
p { color: blue; }
#intro { color: black; } (a) red (b) blue (c) orange (d) black - 24.🔍 Which is the odd one out? (a) checks a quiz answer (b) makes a form box (c) shows a pop-up message (d) reacts to a button click
-
25.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (max-width: 480px) {
p {
font-size: 16px;
}
} (a) Yes (b) No -
26.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 600px) {
p {
font-size: 8px;
}
} -
27.⚖️ What colour is the text of this element?
<p class="red" id="intro">Hi</p>
CSS:
#intro { color: black; }
p { color: green; }
.red { color: orange; } (a) green (b) red (c) black (d) orange - 28.What does color do? (a) makes letters bigger (b) centres a heading (c) sets the letter colour (d) colours behind the text
-
29.⚖️ What colour is the text of this element?
<p class="menu" id="top">Hi</p>
CSS:
#top { color: purple; }
p { color: red; } (a) purple (b) white (c) red (d) green - 30.True or false: p is an id selector. (a) True (b) False
-
31.🎯 Which CSS selector matches this element?
<div class="star" id="hero">Hello</div> (a) div (b) .hero (c) span (d) #top - 32.🎯 Which element does the selector h1 style? (a) <h1 class="star"> (b) <li class="star"> (c) <h2> (d) <div id="main">
- 33.🌈 Which hex code is bright green? (a) #000000 (b) #ff0000 (c) #00ff00 (d) #ffffff
- 34.🌈 Which colour is #00ffff? (a) cyan (b) red (c) blue (d) yellow
-
35.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 170px;
justify-content: flex-end;
}
Inside are 2 boxes, each 80px wide (no margins). -
36.📱 The screen is 540px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (max-width: 480px) {
p {
font-size: 18px;
}
} (a) No (b) Yes - 37.True or false: .note is an id selector. (a) True (b) False
-
38.✍️ What is the selector in this CSS rule?
li {
padding: 8px;
width: 300px;
margin: 10px;
} (a) 300px (b) body (c) padding (d) li - 39.🌈 Which colour is rgb(0, 0, 0)? (a) white (b) black (c) yellow (d) bright green
- 40.🧩 Which language rounds box corners? (a) JavaScript (b) HTML (c) CSS
Answer key
- #000000
- No
- margin
- <h2 class="box">
- red
- ;
- False
- 32
- #00ffff
- .
- white
- background-color
- True
- yellow
- blue
- equal gaps, none at ends
- puts a picture on a page
- h2
- 1
- 67
- JavaScript
- False
- black
- makes a form box
- Yes
- 12
- black
- sets the letter colour
- purple
- False
- div
- <h1 class="star">
- #00ff00
- cyan
- 10
- No
- False
- li
- black
- CSS
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids