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 is the odd one out? (a) reacts to a button click (b) rounds box corners (c) counts down a timer (d) checks a quiz answer
- 2.🌈 Which colour is #ffff00? (a) bright green (b) blue (c) white (d) yellow
- 3.🎯 Which sign starts a class selector? (a) & (b) @ (c) # (d) .
- 4.🎯 Which element does the selector .big style? (a) <h1 class="red"> (b) <h1 id="big"> (c) <h2 class="box"> (d) <h1 class="big">
-
5.⚖️ What colour is the text of this element?
<h2 class="big" id="intro">Hi</h2>
CSS:
h2 { color: green; }
h2 { color: purple; } (a) purple (b) orange (c) black (d) green -
6.⚖️ What colour is the text of this element?
<p class="big" id="end">Hi</p>
CSS:
.big { color: yellow; }
.big { color: white; } (a) yellow (b) red (c) white (d) blue - 7.🧩 Which language changes the text size? (a) CSS (b) JavaScript (c) HTML
-
8.⚖️ What colour is the text of this element?
<p class="menu" id="hero">Hi</p>
CSS:
.menu { color: green; }
p { color: white; } (a) red (b) white (c) green (d) purple - 9.📱 Which tag helps phones show a page at the right size? (a) the br tag (b) the hr tag (c) the viewport meta tag (d) the title tag
-
10.🎯 Which CSS selector matches this element?
<h2 class="menu" id="intro">Hello</h2> (a) #menu (b) #intro (c) .intro (d) li - 11.🖌️ Which CSS property colours behind the text? (a) background-color (b) font-weight (c) font-family (d) color
- 12.Which of these does CSS do? (a) puts a picture on a page (b) makes a link (c) sets colours and fonts (d) makes a form box
- 13.Which of these does CSS do? (a) makes headings and lists (b) changes the text size (c) changes the page live (d) makes a form box
- 14.True or false: JavaScript reacts to a button click. (a) False (b) True
- 15.Which of these does HTML do? (a) changes the text size (b) rounds box corners (c) puts a picture on a page (d) adds space around boxes
-
16.✍️ What value is given to font-weight in this rule?
p {
width: 300px;
font-weight: bold;
margin: 10px;
} (a) 2px solid (b) bold (c) font-weight (d) 300px - 17.⚖️ Which selector is the strongest? (a) an id selector (b) an element selector (c) a class selector
-
18.⚖️ What colour is the text of this element?
<h2 class="big" id="logo">Hi</h2>
CSS:
h2 { color: green; }
#logo { color: blue; }
.big { color: red; } (a) purple (b) blue (c) green (d) red - 19.💪 Which flexbox property turns on flexbox? (a) align-items (b) justify-content (c) display: flex (d) gap
- 20.🔍 Which is the odd one out? (a) makes a form box (b) adds space around boxes (c) sets colours and fonts (d) lays out the page
- 21.📱 What does a media query check? (a) the page title (b) the time of day (c) the screen width (d) the battery level
- 22.True or false: the border is a solid or dotted edge. (a) False (b) True
- 23.🎯 What kind of selector is #logo? (a) an id selector (b) an element selector (c) a class selector
- 24.What does justify-content: flex-start do? (a) puts boxes in the middle (b) packs boxes at the end (c) packs boxes at the start (d) equal gaps, none at ends
- 25.📦 In the box model, which part is the text or picture? (a) padding (b) border (c) margin (d) content
- 26.🧩 Which language makes a form box? (a) HTML (b) CSS (c) JavaScript
-
27.⚖️ What colour is the text of this element?
<h2 class="note" id="top">Hi</h2>
CSS:
#top { color: blue; }
#top { color: red; } (a) purple (b) blue (c) yellow (d) red - 28.🌈 Which colour is rgb(255, 255, 0)? (a) blue (b) yellow (c) black (d) cyan
-
29.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 320px;
justify-content: flex-start;
}
Inside are 4 boxes, each 60px wide (no margins). - 30.True or false: #main is an id selector. (a) True (b) False
-
31.⚖️ What colour is the text of this element?
<p class="big" id="intro">Hi</p>
CSS:
p { color: blue; }
#intro { color: yellow; }
.big { color: green; } (a) yellow (b) blue (c) red (d) green -
32.✍️ What is the selector in this CSS rule?
#top {
padding: 8px;
color: red;
font-size: 20px;
margin: 10px;
} (a) red (b) li (c) padding (d) #top - 33.🌈 In #bd0000 the red part is the hex number bd. What is it as a normal number?
- 34.What does color do? (a) sets the letter colour (b) picks the font style (c) colours behind the text (d) makes the text bold
-
35.✍️ How many declarations (property: value pairs) are in this rule?
h1 {
width: 300px;
margin: 10px;
} - 36.🌈 Which colour is #0000ff? (a) cyan (b) blue (c) yellow (d) black
-
37.📱 The screen is 414px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (max-width: 600px) {
p {
font-size: 18px;
}
} (a) Yes (b) No - 38.🎨 One CSS file can style how many pages? (a) no pages (b) only one image (c) many pages (d) only one word
- 39.🌈 In #00008d the blue part is the hex number 8d. What is it as a normal number?
- 40.🔍 Which is the odd one out? (a) checks a quiz answer (b) lays out the page (c) sets colours and fonts (d) rounds box corners
Answer key
- rounds box corners
- yellow
- .
- <h1 class="big">
- purple
- white
- CSS
- green
- the viewport meta tag
- #intro
- background-color
- sets colours and fonts
- changes the text size
- True
- puts a picture on a page
- bold
- an id selector
- blue
- display: flex
- makes a form box
- the screen width
- True
- an id selector
- packs boxes at the start
- content
- HTML
- red
- yellow
- 80
- True
- yellow
- #top
- 189
- sets the letter colour
- 2
- blue
- Yes
- many pages
- 141
- checks a quiz answer
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids