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 kind of selector is p? (a) a class selector (b) an element selector (c) an id selector
- 2.True or false: CSS makes headings and lists. (a) False (b) True
- 3.💪 Which flexbox property picks row or column? (a) display: flex (b) justify-content (c) align-items (d) flex-direction
- 4.🎯 How many elements on a page should have the same id? (a) any number (b) 2 (c) 5 (d) 1
- 5.True or false: CSS sets colours and fonts. (a) False (b) True
-
6.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 160px;
justify-content: flex-start;
}
Inside are 3 boxes, each 40px wide (no margins). - 7.🎯 Which element does the selector #hero style? (a) <span id="top"> (b) <span id="hero"> (c) <span class="hero"> (d) <p class="note">
-
8.✍️ What is the selector in this CSS rule?
body {
padding: 8px;
font-style: italic;
width: 300px;
} (a) padding (b) italic (c) .box (d) body - 9.📱 max-width: 600px applies when the screen is ___. (a) turned off (b) exactly 1000px (c) 600px or narrower (d) 600px or wider
- 10.🎨 One CSS file can style how many pages? (a) only one image (b) no pages (c) many pages (d) only one word
-
11.✍️ How many declarations (property: value pairs) are in this rule?
h1 {
color: red;
} -
12.✍️ What is the selector in this CSS rule?
body {
font-size: 20px;
font-weight: bold;
} (a) .box (b) bold (c) body (d) font-size - 13.True or false: padding is the text or picture. (a) False (b) True
- 14.🔍 Which is the odd one out? (a) makes headings and lists (b) rounds box corners (c) sets colours and fonts (d) adds space around boxes
- 15.🔍 Which is the odd one out? (a) makes a link (b) makes a form box (c) shows a pop-up message (d) gives the page structure
- 16.Which of these is margin? (a) a solid or dotted edge (b) space outside the border (c) the gap round content (d) the line round the box
-
17.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 250px;
padding: 30px;
border: 1px solid black;
margin: 5px;
} - 18.🌈 Which colour is #00ffff? (a) red (b) cyan (c) white (d) yellow
-
19.✍️ What value is given to margin in this rule?
.note {
text-align: center;
margin: 10px;
} (a) margin (b) 10px (c) bold (d) 8px -
20.⚖️ What colour is the text of this element?
<p class="red" id="intro">Hi</p>
CSS:
p { color: purple; }
p { color: green; } (a) purple (b) blue (c) yellow (d) green -
21.🖌️ Where does the text sit on its line?
h1 {
font-size: 32px;
text-align: center;
color: blue;
background-color: black;
} (a) on the right (b) on the left (c) in the middle - 22.🌈 Which colour is rgb(255, 255, 255)? (a) cyan (b) bright green (c) black (d) white
- 23.🎯 What kind of selector is h1? (a) a class selector (b) an id selector (c) an element selector
-
24.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (min-width: 768px) {
p {
font-size: 18px;
}
} - 25.🧩 Which language makes a link? (a) HTML (b) JavaScript (c) CSS
-
26.🖌️ What colour are the letters?
p {
font-size: 20px;
text-align: center;
color: orange;
background-color: yellow;
} (a) red (b) orange (c) yellow -
27.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (min-width: 1024px) {
p {
font-size: 18px;
}
} (a) Yes (b) No - 28.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the first one (b) the later one (c) the shorter one (d) neither
-
29.🎯 Which CSS selector matches this element?
<span class="note" id="hero">Hello</span> (a) #hero (b) .hero (c) .big (d) p - 30.🌈 Which colour is #00ff00? (a) red (b) bright green (c) cyan (d) blue
- 31.🌈 In #0000c2 the blue part is the hex number c2. What is it as a normal number?
- 32.What does font-weight do? (a) centres a heading (b) sets the letter colour (c) makes letters bigger (d) makes the text bold
-
33.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 600px) {
p {
font-size: 18px;
}
} - 34.What does justify-content: center do? (a) packs boxes at the start (b) puts boxes in the middle (c) packs boxes at the end (d) equal gaps, none at ends
- 35.True or false: HTML reacts to a button click. (a) False (b) True
- 36.True or false: margin is the line round the box. (a) True (b) False
- 37.🖌️ Which CSS property picks the font style? (a) background-color (b) font-weight (c) font-family (d) color
- 38.Which of these does HTML do? (a) shows a pop-up message (b) rounds box corners (c) makes a form box (d) checks a quiz answer
- 39.🎯 Which element does the selector .note style? (a) <h1 id="note"> (b) <h1 class="note"> (c) <h2 class="red"> (d) <h1 class="big">
- 40.🧩 Which language lays out the page? (a) CSS (b) JavaScript (c) HTML
Answer key
- an element selector
- False
- flex-direction
- 1
- True
- 40
- <span id="hero">
- body
- 600px or narrower
- many pages
- 1
- body
- False
- makes headings and lists
- shows a pop-up message
- space outside the border
- 322
- cyan
- 10px
- green
- in the middle
- white
- an element selector
- 12
- HTML
- orange
- No
- the later one
- #hero
- bright green
- 194
- makes the text bold
- 20
- puts boxes in the middle
- False
- False
- font-family
- makes a form box
- <h1 class="note">
- CSS
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids