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 element does the selector .note style? (a) <h1 class="red"> (b) <p class="note"> (c) <p id="note"> (d) <p class="big">
- 2.🎯 What kind of selector is h1? (a) an element selector (b) an id selector (c) a class selector
- 3.🌈 In #rrggbb, which colour do the first two digits give? (a) black (b) red (c) green (d) blue
- 4.🎯 Which element does the selector .big style? (a) <p class="big"> (b) <h1 class="box"> (c) <p class="red"> (d) <p id="big">
-
5.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (max-width: 480px) {
p {
font-size: 14px;
}
} (a) No (b) Yes - 6.Which of these does JavaScript do? (a) rounds box corners (b) gives the page structure (c) adds space around boxes (d) reacts to a button click
- 7.📦 In the box model, which part is space inside the border? (a) border (b) content (c) margin (d) padding
- 8.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) the first one (c) the later one (d) neither
-
9.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 480px) {
p {
font-size: 10px;
}
} (a) No (b) Yes -
10.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 410px;
justify-content: flex-end;
}
Inside are 4 boxes, each 100px wide (no margins). - 11.🌈 Which colour is #00ff00? (a) white (b) red (c) cyan (d) bright green
- 12.🎯 What kind of selector is #end? (a) a class selector (b) an element selector (c) an id selector
- 13.🔍 Which is the odd one out? (a) shows a pop-up message (b) changes the page live (c) checks a quiz answer (d) lays out the page
- 14.✍️ CSS declarations go inside which brackets? (a) ( ) (b) < > (c) { } (d) [ ]
- 15.🎯 What kind of selector is .menu? (a) an id selector (b) a class selector (c) an element selector
-
16.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 60px;
padding: 25px;
border: 2px solid black;
margin: 15px;
} - 17.✍️ Which sign ends each CSS declaration? (a) ; (b) , (c) . (d) :
- 18.What does font-family do? (a) picks the font style (b) colours behind the text (c) sets the letter colour (d) centres a heading
-
19.🎯 Which CSS selector matches this element?
<h1 class="red" id="logo">Hello</h1> (a) .logo (b) #red (c) h2 (d) h1 - 20.🌈 Which hex code is bright green? (a) #ff0000 (b) #00ffff (c) #00ff00 (d) #0000ff
-
21.🖌️ What colour are the letters?
li {
color: purple;
font-size: 32px;
text-align: left;
background-color: white;
} (a) white (b) orange (c) purple - 22.What does justify-content: space-between do? (a) puts boxes in the middle (b) packs boxes at the start (c) equal gaps, none at ends (d) packs boxes at the end
- 23.⚖️ Which selector is the weakest? (a) an element selector (b) a class selector (c) an id selector
- 24.✍️ How does a CSS comment start? (a) /* (b) <!-- (c) # (d) //
- 25.💪 Which justify-content value packs boxes at the end? (a) space-between (b) flex-start (c) flex-end (d) center
-
26.⚖️ What colour is the text of this element?
<h1 class="box" id="end">Hi</h1>
CSS:
.box { color: orange; }
#end { color: black; } (a) black (b) purple (c) blue (d) orange - 27.🌈 Which colour is rgb(255, 0, 255)? (a) blue (b) magenta (c) black (d) cyan
- 28.🎨 One CSS file can style how many pages? (a) only one word (b) only one image (c) no pages (d) many pages
-
29.✍️ What value is given to background-color in this rule?
#top {
color: red;
width: 300px;
background-color: yellow;
} (a) yellow (b) 8px (c) 10px (d) background-color - 30.🧩 Which language changes the page live? (a) JavaScript (b) HTML (c) CSS
-
31.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 600px) {
p {
font-size: 14px;
}
} -
32.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (min-width: 768px) {
p {
font-size: 24px;
}
} (a) No (b) Yes -
33.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 80px;
padding: 5px;
border: 3px solid black;
margin: 0px;
} - 34.🌈 Which colour is #ffff00? (a) blue (b) yellow (c) black (d) magenta
- 35.🖌️ Which CSS property picks the font style? (a) color (b) font-size (c) background-color (d) font-family
- 36.🔍 Which is the odd one out? (a) reacts to a button click (b) makes headings and lists (c) makes a form box (d) puts a picture on a page
-
37.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 768px) {
p {
font-size: 14px;
}
} (a) No (b) Yes -
38.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 1024px) {
p {
font-size: 32px;
}
} -
39.🎯 Which CSS selector matches this element?
<h2 class="note" id="end">Hello</h2> (a) #hero (b) .note (c) li (d) #note - 40.True or false: the border is a solid or dotted edge. (a) False (b) True
Answer key
- <p class="note">
- an element selector
- red
- <p class="big">
- Yes
- reacts to a button click
- padding
- the later one
- Yes
- 10
- bright green
- an id selector
- lays out the page
- { }
- a class selector
- 144
- ;
- picks the font style
- h1
- #00ff00
- purple
- equal gaps, none at ends
- an element selector
- /*
- flex-end
- black
- magenta
- many pages
- yellow
- JavaScript
- 14
- No
- 96
- yellow
- font-family
- reacts to a button click
- Yes
- 24
- .note
- True
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids