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) counts down a timer (c) lays out the page (d) changes the page live
- 2.🌈 Hex digits go 0 to 9, then A to which letter? (a) G (b) Z (c) F (d) J
- 3.🎯 What kind of selector is .menu? (a) a class selector (b) an element selector (c) an id selector
- 4.🔍 Which is the odd one out? (a) sets colours and fonts (b) gives the page structure (c) makes a form box (d) makes a link
-
5.🎯 Which CSS selector matches this element?
<div class="note" id="end">Hello</div> (a) .note (b) #note (c) span (d) .end - 6.🔍 Which is the odd one out? (a) gives the page structure (b) adds space around boxes (c) rounds box corners (d) lays out the page
-
7.🖌️ What colour are the letters?
li {
text-align: right;
color: purple;
background-color: green;
font-size: 20px;
} (a) green (b) purple (c) white - 8.📦 In the box model, which part is space outside the border? (a) padding (b) margin (c) content (d) border
-
9.✍️ Which property is set to 10px in this rule?
.note {
color: red;
margin: 10px;
text-align: center;
font-size: 20px;
} (a) font-weight (b) padding (c) 10px (d) margin - 10.🌈 Which colour is rgb(0, 255, 0)? (a) blue (b) bright green (c) black (d) red
-
11.🎯 Which CSS selector matches this element?
<h1 class="big" id="hero">Hello</h1> (a) h2 (b) .hero (c) .big (d) .red -
12.🎯 Which CSS selector matches this element?
<span class="red" id="logo">Hello</span> (a) .logo (b) p (c) span (d) #red - 13.🧩 Which language rounds box corners? (a) HTML (b) CSS (c) JavaScript
- 14.✍️ Which sign goes between a property and its value? (a) ; (b) = (c) : (d) -
-
15.📱 The screen is 700px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 480px) {
p {
font-size: 14px;
}
} (a) Yes (b) No - 16.🌈 Which colour is rgb(255, 0, 0)? (a) magenta (b) red (c) yellow (d) blue
- 17.💪 Which flexbox property lines boxes up across? (a) justify-content (b) gap (c) flex-direction (d) align-items
- 18.📱 What does a media query check? (a) the time of day (b) the battery level (c) the screen width (d) the page title
- 19.Which of these does JavaScript do? (a) puts a picture on a page (b) shows a pop-up message (c) sets colours and fonts (d) makes a link
-
20.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 768px) {
p {
font-size: 18px;
}
} -
21.✍️ What is the selector in this CSS rule?
h2 {
font-style: italic;
border: 2px solid;
padding: 8px;
} (a) h2 (b) h1 (c) font-style (d) 2px solid - 22.⚖️ Which selector is the weakest? (a) an id selector (b) a class selector (c) an element selector
-
23.⚖️ What colour is the text of this element?
<h2 class="menu" id="end">Hi</h2>
CSS:
h2 { color: white; }
h2 { color: blue; } (a) green (b) blue (c) white (d) purple -
24.✍️ Which property is set to 2px solid in this rule?
li {
font-weight: bold;
color: red;
border: 2px solid;
} (a) border (b) font-style (c) width (d) 2px solid - 25.🔍 Which is the odd one out? (a) shows a pop-up message (b) gives the page structure (c) makes a link (d) makes a form box
- 26.What does justify-content: flex-start do? (a) equal gaps, none at ends (b) puts boxes in the middle (c) packs boxes at the start (d) packs boxes at the end
- 27.📱 max-width: 600px applies when the screen is ___. (a) 600px or wider (b) 600px or narrower (c) turned off (d) exactly 1000px
- 28.True or false: the content is a solid or dotted edge. (a) True (b) False
- 29.✍️ CSS declarations go inside which brackets? (a) { } (b) ( ) (c) [ ] (d) < >
- 30.True or false: JavaScript counts down a timer. (a) False (b) True
- 31.🌈 In #d80000 the red part is the hex number d8. What is it as a normal number?
- 32.🎨 Which tag holds CSS inside the head? (a) <css> (b) <script> (c) <style> (d) <body>
-
33.🖌️ How big is the text, in px?
p {
background-color: purple;
text-align: left;
color: black;
font-size: 24px;
} - 34.🎯 Can many elements share the same class? (a) Yes (b) No
- 35.True or false: img is a class selector. (a) True (b) False
- 36.🌈 Which colour of light is strongest in rgb(139, 161, 12)? (a) blue (b) red (c) green
- 37.What does font-family do? (a) picks the font style (b) sets the letter colour (c) centres a heading (d) makes the text bold
- 38.📦 In the box model, which part is space inside the border? (a) border (b) content (c) padding (d) margin
- 39.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the first one (b) neither (c) the shorter one (d) the later one
- 40.Which of these does CSS do? (a) makes a form box (b) reacts to a button click (c) sets colours and fonts (d) shows a pop-up message
Answer key
- lays out the page
- F
- a class selector
- sets colours and fonts
- .note
- gives the page structure
- purple
- margin
- margin
- bright green
- .big
- span
- CSS
- :
- No
- red
- align-items
- the screen width
- shows a pop-up message
- 16
- h2
- an element selector
- blue
- border
- shows a pop-up message
- packs boxes at the start
- 600px or narrower
- False
- { }
- True
- 216
- <style>
- 24
- Yes
- False
- green
- picks the font style
- padding
- the later one
- sets colours and fonts
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids