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) shows a pop-up message (c) rounds box corners (d) checks a quiz answer
- 2.🌈 Which colour is #00ff00? (a) white (b) magenta (c) blue (d) bright green
- 3.🌈 Which hex code is cyan? (a) #ffff00 (b) #00ffff (c) #000000 (d) #00ff00
- 4.What does font-weight do? (a) colours behind the text (b) picks the font style (c) sets the letter colour (d) makes the text bold
- 5.🎯 What kind of selector is .menu? (a) an element selector (b) a class selector (c) an id selector
- 6.🌈 In #rrggbb, which colour do the last two digits give? (a) red (b) blue (c) green (d) white
- 7.What does font-size do? (a) colours behind the text (b) centres a heading (c) makes letters bigger (d) sets the letter colour
- 8.True or false: JavaScript sets colours and fonts. (a) True (b) False
- 9.🎯 Which element does the selector li style? (a) <span class="note"> (b) <li class="note"> (c) <p id="top"> (d) <div>
- 10.🖌️ Which CSS property colours behind the text? (a) background-color (b) font-size (c) text-align (d) font-weight
- 11.⚖️ Which selector is the weakest? (a) an id selector (b) a class selector (c) an element selector
- 12.⚖️ Which selector is the strongest? (a) a class selector (b) an element selector (c) an id selector
- 13.🎨 Which tag holds CSS inside the head? (a) <body> (b) <style> (c) <script> (d) <css>
- 14.True or false: JavaScript lays out the page. (a) False (b) True
-
15.🖌️ What colour is behind the letters?
h1 {
text-align: center;
background-color: yellow;
color: blue;
font-size: 16px;
} (a) yellow (b) purple (c) blue - 16.✍️ In color: blue; which part is the property? (a) color (b) : (c) blue (d) ;
- 17.✍️ CSS declarations go inside which brackets? (a) { } (b) < > (c) ( ) (d) [ ]
-
18.✍️ What is the selector in this CSS rule?
body {
text-align: center;
color: red;
} (a) red (b) .box (c) body (d) text-align -
19.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 50px;
padding: 15px;
border: 1px solid black;
margin: 20px;
} - 20.💪 Which justify-content value packs boxes at the start? (a) center (b) flex-end (c) flex-start (d) space-between
- 21.🎨 A CSS file usually ends with which extension? (a) .js (b) .png (c) .html (d) .css
- 22.🌈 Which colour of light is strongest in rgb(206, 49, 128)? (a) blue (b) green (c) red
- 23.🔍 Which is the odd one out? (a) counts down a timer (b) makes headings and lists (c) shows a pop-up message (d) reacts to a button click
- 24.True or false: margin is the gap round content. (a) True (b) False
- 25.🔍 Which is the odd one out? (a) changes the page live (b) puts a picture on a page (c) gives the page structure (d) makes a form box
-
26.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 260px;
justify-content: flex-end;
}
Inside are 2 boxes, each 100px wide (no margins). - 27.✍️ How does a CSS comment start? (a) <!-- (b) /* (c) # (d) //
-
28.⚖️ What colour is the text of this element?
<h1 class="box" id="end">Hi</h1>
CSS:
h1 { color: yellow; }
.box { color: red; } (a) black (b) white (c) yellow (d) red -
29.⚖️ What colour is the text of this element?
<p class="big" id="top">Hi</p>
CSS:
.big { color: black; }
p { color: blue; } (a) blue (b) yellow (c) purple (d) black -
30.📱 The screen is 540px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (min-width: 768px) {
p {
font-size: 20px;
}
} (a) No (b) Yes - 31.True or false: CSS rounds box corners. (a) False (b) True
-
32.⚖️ What colour is the text of this element?
<h2 class="red" id="hero">Hi</h2>
CSS:
.red { color: white; }
.red { color: yellow; } (a) orange (b) white (c) yellow (d) red -
33.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 1024px) {
p {
font-size: 8px;
}
} - 34.🖌️ Which CSS property sets the letter colour? (a) text-align (b) color (c) background-color (d) font-family
-
35.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 100px;
justify-content: flex-end;
}
Inside are 2 boxes, each 40px wide (no margins). - 36.📦 In the box model, which part is space inside the border? (a) content (b) border (c) margin (d) padding
- 37.True or false: the border is the line round the box. (a) True (b) False
- 38.True or false: #hero is an id selector. (a) True (b) False
-
39.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 1024px) {
p {
font-size: 8px;
}
} -
40.🖌️ Where does the text sit on its line?
p {
background-color: white;
text-align: right;
font-size: 24px;
color: yellow;
} (a) on the right (b) in the middle (c) on the left
Answer key
- rounds box corners
- bright green
- #00ffff
- makes the text bold
- a class selector
- blue
- makes letters bigger
- False
- <li class="note">
- background-color
- an element selector
- an id selector
- <style>
- False
- yellow
- color
- { }
- body
- 122
- flex-start
- .css
- red
- makes headings and lists
- False
- changes the page live
- 60
- /*
- red
- black
- No
- True
- yellow
- 12
- color
- 20
- padding
- True
- True
- 8
- on the right
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids