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.What does text-align do? (a) makes the text bold (b) centres a heading (c) makes letters bigger (d) sets the letter colour
- 2.🔍 Which is the odd one out? (a) adds space around boxes (b) sets colours and fonts (c) reacts to a button click (d) lays out the page
-
3.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (max-width: 480px) {
p {
font-size: 18px;
}
} (a) No (b) Yes - 4.🎯 Which element does the selector p style? (a) <h2 class="note"> (b) <li id="top"> (c) <h1> (d) <p class="note">
-
5.🖌️ How big is the text, in px?
li {
text-align: center;
font-size: 20px;
color: white;
background-color: green;
} - 6.⚖️ Which selector is the weakest? (a) an element selector (b) an id selector (c) a class selector
- 7.🧩 Which language shows a pop-up message? (a) CSS (b) HTML (c) JavaScript
- 8.What does justify-content: flex-start 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
-
9.⚖️ What colour is the text of this element?
<h1 class="red" id="logo">Hi</h1>
CSS:
h1 { color: white; }
h1 { color: green; } (a) green (b) purple (c) yellow (d) white - 10.🔍 Which is the odd one out? (a) gives the page structure (b) changes the text size (c) lays out the page (d) sets colours and fonts
- 11.What does font-size do? (a) centres a heading (b) sets the letter colour (c) colours behind the text (d) makes letters bigger
- 12.🌈 Which colour of light is strongest in rgb(103, 255, 102)? (a) green (b) blue (c) red
- 13.✍️ Which sign ends each CSS declaration? (a) ; (b) , (c) . (d) :
- 14.What does font-weight do? (a) makes letters bigger (b) sets the letter colour (c) makes the text bold (d) colours behind the text
-
15.📱 The screen is 820px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 480px) {
p {
font-size: 10px;
}
} (a) Yes (b) No - 16.📦 In the box model, which part is space inside the border? (a) content (b) padding (c) margin (d) border
- 17.✍️ Which sign goes between a property and its value? (a) = (b) - (c) : (d) ;
-
18.🖌️ What colour are the letters?
h1 {
font-size: 36px;
color: red;
background-color: blue;
text-align: center;
} (a) blue (b) red (c) yellow - 19.🎯 Which element does the selector div style? (a) <h1 id="intro"> (b) <p class="menu"> (c) <span> (d) <div class="menu">
-
20.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 480px) {
p {
font-size: 10px;
}
} - 21.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the later one (b) the first one (c) neither (d) the shorter one
- 22.🎯 What kind of selector is li? (a) an id selector (b) a class selector (c) an element selector
- 23.🌈 Which colour is #000000? (a) bright green (b) white (c) yellow (d) black
- 24.🎯 What kind of selector is #logo? (a) an element selector (b) an id selector (c) a class selector
- 25.True or false: HTML lays out the page. (a) True (b) False
- 26.📱 What does a media query check? (a) the time of day (b) the battery level (c) the page title (d) the screen width
- 27.⚖️ Which selector is the strongest? (a) an element selector (b) an id selector (c) a class selector
-
28.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 600px) {
p {
font-size: 14px;
}
} (a) No (b) Yes - 29.🎯 What kind of selector is .big? (a) an element selector (b) an id selector (c) a class selector
- 30.🔍 Which is the odd one out? (a) checks a quiz answer (b) makes headings and lists (c) puts a picture on a page (d) makes a form box
- 31.True or false: CSS sets colours and fonts. (a) False (b) True
- 32.🔍 Which is the odd one out? (a) reacts to a button click (b) changes the page live (c) sets colours and fonts (d) checks a quiz answer
- 33.🖌️ Which CSS property centres a heading? (a) font-family (b) background-color (c) text-align (d) font-size
-
34.📱 The screen is 414px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (max-width: 768px) {
p {
font-size: 22px;
}
} (a) No (b) Yes -
35.✍️ How many declarations (property: value pairs) are in this rule?
p {
width: 300px;
font-style: italic;
padding: 8px;
font-size: 20px;
} -
36.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 230px;
padding: 5px;
border: 2px solid black;
margin: 15px;
} -
37.📱 The screen is 820px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 600px) {
p {
font-size: 10px;
}
} (a) No (b) Yes - 38.💪 Which justify-content value packs boxes at the start? (a) flex-end (b) center (c) flex-start (d) space-between
-
39.⚖️ What colour is the text of this element?
<h1 class="box" id="intro">Hi</h1>
CSS:
#intro { color: yellow; }
#intro { color: white; } (a) red (b) white (c) yellow (d) black -
40.🎯 Which CSS selector matches this element?
<h2 class="red" id="top">Hello</h2> (a) #top (b) #red (c) li (d) .top
Answer key
- centres a heading
- reacts to a button click
- Yes
- <p class="note">
- 20
- an element selector
- JavaScript
- packs boxes at the start
- green
- gives the page structure
- makes letters bigger
- green
- ;
- makes the text bold
- No
- padding
- :
- red
- <div class="menu">
- 10
- the later one
- an element selector
- black
- an id selector
- False
- the screen width
- an id selector
- Yes
- a class selector
- checks a quiz answer
- True
- sets colours and fonts
- text-align
- Yes
- 4
- 274
- No
- flex-start
- white
- #top
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids