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 red? (a) #000000 (b) #00ffff (c) #ff00ff (d) #ff0000
- 2.🔍 Which is the odd one out? (a) shows a pop-up message (b) makes a link (c) puts a picture on a page (d) makes headings and lists
- 3.✍️ Which sign ends each CSS declaration? (a) ; (b) . (c) : (d) ,
-
4.⚖️ What colour is the text of this element?
<h1 class="note" id="top">Hi</h1>
CSS:
.note { color: white; }
h1 { color: red; }
#top { color: blue; } (a) white (b) yellow (c) blue (d) red - 5.💪 Which flexbox property turns on flexbox? (a) display: flex (b) flex-direction (c) justify-content (d) align-items
-
6.🖌️ Where does the text sit on its line?
h1 {
background-color: red;
text-align: left;
color: purple;
font-size: 40px;
} (a) in the middle (b) on the right (c) on the left - 7.🎨 What does CSS stand for? (a) Cascading Style Sheets (b) Creative Sheet System (c) Computer Style Sheets (d) Colourful Site Styles
-
8.⚖️ What colour is the text of this element?
<h2 class="big" id="main">Hi</h2>
CSS:
.big { color: purple; }
#main { color: green; }
h2 { color: red; } (a) purple (b) green (c) blue (d) red - 9.🎯 Which element does the selector li style? (a) <p id="hero"> (b) <li class="menu"> (c) <div> (d) <span class="menu">
- 10.🎯 What kind of selector is .card? (a) an id selector (b) an element selector (c) a class selector
- 11.⚖️ Which selector is the strongest? (a) an id selector (b) a class selector (c) an element selector
- 12.What does justify-content: flex-start do? (a) puts boxes in the middle (b) packs boxes at the end (c) equal gaps, none at ends (d) packs boxes at the start
-
13.⚖️ What colour is the text of this element?
<h2 class="menu" id="logo">Hi</h2>
CSS:
#logo { color: black; }
h2 { color: white; } (a) red (b) blue (c) white (d) black - 14.📱 What does a media query check? (a) the page title (b) the battery level (c) the screen width (d) the time of day
-
15.📱 The screen is 540px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 768px) {
p {
font-size: 32px;
}
} (a) Yes (b) No - 16.💪 Which flexbox property spaces boxes along a row? (a) display: flex (b) justify-content (c) flex-direction (d) gap
-
17.🎯 Which CSS selector matches this element?
<p class="box" id="top">Hello</p> (a) .star (b) #box (c) #intro (d) p -
18.⚖️ What colour is the text of this element?
<h2 class="note" id="main">Hi</h2>
CSS:
#main { color: white; }
#main { color: yellow; } (a) white (b) yellow (c) blue (d) green - 19.What does font-family do? (a) picks the font style (b) sets the letter colour (c) makes letters bigger (d) makes the text bold
-
20.✍️ How many declarations (property: value pairs) are in this rule?
h2 {
width: 300px;
} - 21.🖌️ Which CSS property picks the font style? (a) font-size (b) background-color (c) color (d) font-family
-
22.✍️ How many declarations (property: value pairs) are in this rule?
p {
border: 2px solid;
} - 23.🎯 Which element does the selector li style? (a) <div> (b) <li class="note"> (c) <p id="main"> (d) <span class="note">
- 24.🎯 What kind of selector is #main? (a) a class selector (b) an id selector (c) an element selector
-
25.⚖️ What colour is the text of this element?
<p class="red" id="hero">Hi</p>
CSS:
p { color: black; }
p { color: red; } (a) red (b) yellow (c) green (d) black - 26.🖌️ Which CSS property sets the letter colour? (a) text-align (b) color (c) font-size (d) font-weight
- 27.🎨 Which tag connects an outside CSS file? (a) <a> (b) <css> (c) <img> (d) <link>
-
28.✍️ How many declarations (property: value pairs) are in this rule?
p {
font-weight: bold;
} - 29.🌈 In #rrggbb, which colour do the last two digits give? (a) green (b) red (c) blue (d) white
- 30.True or false: margin is the line round the box. (a) False (b) True
- 31.🎯 Which element does the selector #end style? (a) <p id="hero"> (b) <p id="end"> (c) <p class="end"> (d) <h1 class="box">
-
32.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 190px;
padding: 15px;
border: 1px solid black;
margin: 10px;
} - 33.🎯 What kind of selector is .big? (a) a class selector (b) an id selector (c) an element selector
- 34.🖌️ Which CSS property makes the text bold? (a) color (b) background-color (c) text-align (d) font-weight
-
35.🖌️ What colour are the letters?
p {
background-color: purple;
text-align: left;
color: blue;
font-size: 36px;
} (a) purple (b) blue (c) orange - 36.🧩 Which language lays out the page? (a) JavaScript (b) CSS (c) HTML
- 37.🌈 Which colour of light is strongest in rgb(160, 36, 67)? (a) green (b) red (c) blue
- 38.🌈 In #000000 the red part is the hex number 00. What is it as a normal number?
-
39.📱 The screen is 414px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 600px) {
p {
font-size: 12px;
}
} (a) Yes (b) No -
40.⚖️ What colour is the text of this element?
<h1 class="menu" id="intro">Hi</h1>
CSS:
h1 { color: blue; }
h1 { color: red; } (a) orange (b) red (c) yellow (d) blue
Answer key
- #ff0000
- shows a pop-up message
- ;
- blue
- display: flex
- on the left
- Cascading Style Sheets
- green
- <li class="menu">
- a class selector
- an id selector
- packs boxes at the start
- black
- the screen width
- No
- justify-content
- p
- yellow
- picks the font style
- 1
- font-family
- 1
- <li class="note">
- an id selector
- red
- color
- <link>
- 1
- blue
- False
- <p id="end">
- 242
- a class selector
- font-weight
- blue
- CSS
- red
- 0
- Yes
- red
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids