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 CSS property picks the font style? (a) font-size (b) color (c) font-family (d) background-color
- 2.📱 max-width: 600px applies when the screen is ___. (a) exactly 1000px (b) 600px or wider (c) 600px or narrower (d) turned off
- 3.🧩 Which language shows a pop-up message? (a) JavaScript (b) CSS (c) HTML
- 4.🎯 What kind of selector is .card? (a) a class selector (b) an element selector (c) an id selector
- 5.🌈 Which hex code is bright green? (a) #ff00ff (b) #00ff00 (c) #ff0000 (d) #000000
- 6.🌈 Which colour of light is strongest in rgb(76, 250, 106)? (a) red (b) green (c) blue
- 7.🧩 Which language reacts to a button click? (a) HTML (b) JavaScript (c) CSS
- 8.🎯 Which element does the selector .note style? (a) <span class="big"> (b) <span id="note"> (c) <p class="red"> (d) <span class="note">
-
9.⚖️ What colour is the text of this element?
<h2 class="big" id="intro">Hi</h2>
CSS:
.big { color: orange; }
#intro { color: blue; } (a) orange (b) blue (c) black (d) red -
10.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 150px;
justify-content: flex-start;
}
Inside are 2 boxes, each 40px wide (no margins). -
11.🎯 Which CSS selector matches this element?
<h1 class="note" id="main">Hello</h1> (a) .big (b) #note (c) h2 (d) #main - 12.🧩 Which language rounds box corners? (a) HTML (b) JavaScript (c) CSS
-
13.🎯 Which CSS selector matches this element?
<h2 class="menu" id="end">Hello</h2> (a) .end (b) #end (c) #hero (d) li - 14.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the later one (b) the shorter one (c) neither (d) the first one
-
15.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 100px;
padding: 30px;
border: 5px solid black;
margin: 5px;
} - 16.🌈 Which hex code is black? (a) #00ffff (b) #ff0000 (c) #0000ff (d) #000000
- 17.True or false: CSS lays out the page. (a) False (b) True
-
18.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 300px;
justify-content: flex-end;
}
Inside are 4 boxes, each 60px wide (no margins). - 19.🧩 Which language counts down a timer? (a) JavaScript (b) HTML (c) CSS
-
20.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (min-width: 480px) {
p {
font-size: 20px;
}
} - 21.🎯 Which sign starts a class selector? (a) @ (b) # (c) . (d) &
-
22.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 70px;
padding: 15px;
border: 5px solid black;
margin: 10px;
} - 23.🎯 Which element does the selector #top style? (a) <span class="top"> (b) <span id="top"> (c) <p class="note"> (d) <span id="intro">
-
24.⚖️ What colour is the text of this element?
<h1 class="menu" id="intro">Hi</h1>
CSS:
h1 { color: black; }
.menu { color: purple; }
#intro { color: green; } (a) black (b) purple (c) blue (d) green - 25.✍️ CSS declarations go inside which brackets? (a) ( ) (b) < > (c) { } (d) [ ]
-
26.📱 The screen is 1366px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 768px) {
p {
font-size: 8px;
}
} (a) Yes (b) No - 27.Which of these does CSS do? (a) lays out the page (b) puts a picture on a page (c) makes a form box (d) counts down a timer
- 28.⚖️ Which selector is the weakest? (a) an id selector (b) a class selector (c) an element selector
- 29.🖌️ Which CSS property colours behind the text? (a) text-align (b) font-size (c) background-color (d) color
- 30.What does background-color do? (a) colours behind the text (b) makes the text bold (c) sets the letter colour (d) picks the font style
- 31.🎯 Can many elements share the same class? (a) No (b) Yes
-
32.📱 The screen is 700px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 1024px) {
p {
font-size: 14px;
}
} (a) No (b) Yes -
33.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 110px;
justify-content: space-between;
}
Inside are 2 boxes, each 50px wide (no margins). - 34.True or false: HTML reacts to a button click. (a) False (b) True
-
35.🖌️ What colour is behind the letters?
p {
font-size: 24px;
background-color: black;
color: orange;
text-align: left;
} (a) green (b) orange (c) black - 36.Which of these does CSS do? (a) changes the page live (b) reacts to a button click (c) adds space around boxes (d) shows a pop-up message
- 37.🖌️ Which CSS property makes letters bigger? (a) text-align (b) color (c) font-size (d) font-family
- 38.🎨 What does CSS stand for? (a) Creative Sheet System (b) Computer Style Sheets (c) Cascading Style Sheets (d) Colourful Site Styles
-
39.✍️ What is the selector in this CSS rule?
.box {
font-size: 20px;
text-align: center;
margin: 10px;
border: 2px solid;
} (a) h2 (b) .box (c) font-size (d) center - 40.💪 Which justify-content value packs boxes at the start? (a) center (b) flex-end (c) space-between (d) flex-start
Answer key
- font-family
- 600px or narrower
- JavaScript
- a class selector
- #00ff00
- green
- JavaScript
- <span class="note">
- blue
- 70
- #main
- CSS
- #end
- the later one
- 170
- #000000
- True
- 60
- JavaScript
- 20
- .
- 130
- <span id="top">
- green
- { }
- No
- lays out the page
- an element selector
- background-color
- colours behind the text
- Yes
- Yes
- 10
- False
- black
- adds space around boxes
- font-size
- Cascading Style Sheets
- .box
- flex-start
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids