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 is the biggest number one colour can have in rgb()? (a) 255 (b) 1000 (c) 100 (d) 99
- 2.🔍 Which is the odd one out? (a) shows a pop-up message (b) lays out the page (c) sets colours and fonts (d) adds space around boxes
-
3.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 210px;
justify-content: flex-start;
}
Inside are 3 boxes, each 50px wide (no margins). -
4.⚖️ What colour is the text of this element?
<h1 class="menu" id="top">Hi</h1>
CSS:
#top { color: white; }
#top { color: black; } (a) black (b) orange (c) white (d) red - 5.🎯 Which element does the selector p style? (a) <p class="menu"> (b) <li id="intro"> (c) <h2 class="menu"> (d) <h1>
-
6.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 360px;
justify-content: space-between;
}
Inside are 3 boxes, each 80px wide (no margins). - 7.🌈 Which colour is #ff0000? (a) blue (b) cyan (c) red (d) yellow
- 8.🎯 Which element does the selector #hero style? (a) <h2 class="hero"> (b) <li class="red"> (c) <h2 id="hero"> (d) <h2 id="top">
-
9.🎯 Which CSS selector matches this element?
<li class="menu" id="end">Hello</li> (a) .end (b) div (c) #menu (d) #end -
10.✍️ How many declarations (property: value pairs) are in this rule?
h2 {
background-color: yellow;
margin: 10px;
font-weight: bold;
font-style: italic;
} - 11.🎨 What does CSS stand for? (a) Computer Style Sheets (b) Creative Sheet System (c) Cascading Style Sheets (d) Colourful Site Styles
-
12.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 70px;
padding: 5px;
border: 3px solid black;
margin: 15px;
} -
13.🎯 Which CSS selector matches this element?
<p class="note" id="intro">Hello</p> (a) .intro (b) .big (c) p (d) #main -
14.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 160px;
padding: 10px;
border: 1px solid black;
margin: 5px;
} -
15.⚖️ What colour is the text of this element?
<h2 class="big" id="end">Hi</h2>
CSS:
h2 { color: yellow; }
h2 { color: purple; } (a) blue (b) white (c) yellow (d) purple -
16.🖌️ What colour are the letters?
li {
text-align: right;
background-color: purple;
color: white;
font-size: 28px;
} (a) purple (b) white (c) black -
17.🖌️ Where does the text sit on its line?
li {
background-color: white;
text-align: left;
font-size: 40px;
color: blue;
} (a) on the right (b) in the middle (c) on the left - 18.🎯 What kind of selector is img? (a) an element selector (b) an id selector (c) a class selector
-
19.✍️ How many declarations (property: value pairs) are in this rule?
.box {
padding: 8px;
font-size: 20px;
} - 20.🎯 What kind of selector is .card? (a) an element selector (b) an id selector (c) a class selector
- 21.🎯 Which sign starts an id selector? (a) . (b) # (c) & (d) @
-
22.🎯 Which CSS selector matches this element?
<p class="red" id="hero">Hello</p> (a) #top (b) h1 (c) p (d) .box - 23.Which of these does HTML do? (a) makes a form box (b) sets colours and fonts (c) changes the text size (d) checks a quiz answer
- 24.⚖️ Which selector is the strongest? (a) a class selector (b) an element selector (c) an id selector
- 25.What does font-weight do? (a) colours behind the text (b) makes the text bold (c) centres a heading (d) makes letters bigger
- 26.📱 Responsive design means a page ___. (a) fits every screen (b) is only for laptops (c) has no pictures (d) never changes
- 27.True or false: CSS puts a picture on a page. (a) False (b) True
- 28.🌈 In #rrggbb, which colour do the first two digits give? (a) green (b) blue (c) red (d) black
- 29.💪 Which flexbox property spaces boxes along a row? (a) align-items (b) justify-content (c) gap (d) flex-direction
- 30.🎯 Which element does the selector .box style? (a) <div class="star"> (b) <div class="box"> (c) <span class="menu"> (d) <div id="box">
-
31.🎯 Which CSS selector matches this element?
<div class="big" id="hero">Hello</div> (a) #top (b) #big (c) .hero (d) .big - 32.Which of these does CSS do? (a) puts a picture on a page (b) rounds box corners (c) makes a link (d) reacts to a button click
- 33.🎯 Which element does the selector h2 style? (a) <div class="note"> (b) <li> (c) <h2 class="note"> (d) <span id="hero">
- 34.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the first one (b) the shorter one (c) neither (d) the later one
-
35.📱 The screen is 700px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (min-width: 600px) {
p {
font-size: 26px;
}
} (a) No (b) Yes -
36.⚖️ What colour is the text of this element?
<h2 class="menu" id="logo">Hi</h2>
CSS:
h2 { color: black; }
#logo { color: green; }
.menu { color: white; } (a) green (b) black (c) purple (d) white -
37.📱 The screen is 1366px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (max-width: 600px) {
p {
font-size: 18px;
}
} (a) Yes (b) No - 38.🎯 What kind of selector is .note? (a) an element selector (b) a class selector (c) an id selector
-
39.✍️ Which property is set to 2px solid in this rule?
h1 {
border: 2px solid;
width: 300px;
} (a) 2px solid (b) font-style (c) width (d) border -
40.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 200px;
justify-content: flex-start;
}
Inside are 2 boxes, each 60px wide (no margins).
Answer key
- 255
- shows a pop-up message
- 60
- black
- <p class="menu">
- 60
- red
- <h2 id="hero">
- #end
- 4
- Cascading Style Sheets
- 116
- p
- 192
- purple
- white
- on the left
- an element selector
- 2
- a class selector
- #
- p
- makes a form box
- an id selector
- makes the text bold
- fits every screen
- False
- red
- justify-content
- <div class="box">
- .big
- rounds box corners
- <h2 class="note">
- the later one
- Yes
- green
- No
- a class selector
- border
- 80
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids