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 background-color do? (a) makes the text bold (b) centres a heading (c) colours behind the text (d) picks the font style
-
2.⚖️ What colour is the text of this element?
<h2 class="red" id="main">Hi</h2>
CSS:
h2 { color: orange; }
h2 { color: red; } (a) red (b) purple (c) blue (d) orange -
3.🖌️ What colour are the letters?
p {
text-align: right;
color: purple;
font-size: 20px;
background-color: orange;
} (a) orange (b) purple (c) black -
4.✍️ Which property is set to 300px in this rule?
.note {
width: 300px;
font-style: italic;
} (a) font-style (b) color (c) 300px (d) width - 5.🧩 Which language sets colours and fonts? (a) HTML (b) JavaScript (c) CSS
- 6.🔍 Which is the odd one out? (a) makes a form box (b) puts a picture on a page (c) makes headings and lists (d) adds space around boxes
- 7.🌈 Which colour is #00ffff? (a) magenta (b) yellow (c) cyan (d) white
- 8.⚖️ Which selector is the weakest? (a) a class selector (b) an element selector (c) an id selector
- 9.📱 Which tag helps phones show a page at the right size? (a) the title tag (b) the hr tag (c) the viewport meta tag (d) the br tag
- 10.📱 max-width: 600px applies when the screen is ___. (a) 600px or wider (b) exactly 1000px (c) turned off (d) 600px or narrower
- 11.🎯 What kind of selector is #logo? (a) a class selector (b) an id selector (c) an element selector
- 12.What does text-align do? (a) centres a heading (b) makes the text bold (c) sets the letter colour (d) picks the font style
- 13.True or false: CSS sets colours and fonts. (a) True (b) False
-
14.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 230px;
justify-content: flex-start;
}
Inside are 4 boxes, each 50px wide (no margins). -
15.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 600px) {
p {
font-size: 10px;
}
} -
16.📱 The screen is 1366px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (min-width: 768px) {
p {
font-size: 24px;
}
} (a) Yes (b) No - 17.🎯 Which element does the selector #end style? (a) <div class="box"> (b) <li id="end"> (c) <li class="end"> (d) <li id="hero">
- 18.True or false: the content is the text or picture. (a) False (b) True
-
19.✍️ What is the selector in this CSS rule?
p {
padding: 8px;
width: 300px;
text-align: center;
font-style: italic;
} (a) .note (b) padding (c) 300px (d) p - 20.🎯 What kind of selector is .note? (a) an id selector (b) a class selector (c) an element selector
- 21.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) exactly 100px (c) turned off (d) 800px or wider
- 22.🔍 Which is the odd one out? (a) changes the text size (b) puts a picture on a page (c) gives the page structure (d) makes headings and lists
- 23.🌈 Which hex code is yellow? (a) #ff00ff (b) #00ffff (c) #0000ff (d) #ffff00
-
24.✍️ Which property is set to center in this rule?
.box {
text-align: center;
font-style: italic;
color: red;
font-size: 20px;
} (a) center (b) background-color (c) margin (d) text-align - 25.✍️ In color: blue; which part is the value? (a) : (b) blue (c) color (d) ;
- 26.True or false: .star is an element selector. (a) False (b) True
-
27.📱 The screen is 1366px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 600px) {
p {
font-size: 10px;
}
} (a) No (b) Yes - 28.🎯 Which sign starts an id selector? (a) & (b) @ (c) . (d) #
- 29.💪 Which flexbox property turns on flexbox? (a) gap (b) align-items (c) display: flex (d) justify-content
- 30.🖌️ Which CSS property makes letters bigger? (a) text-align (b) font-family (c) font-size (d) background-color
- 31.💪 Which justify-content value packs boxes at the start? (a) flex-end (b) space-between (c) center (d) flex-start
- 32.Which of these does CSS do? (a) makes a link (b) adds space around boxes (c) gives the page structure (d) checks a quiz answer
-
33.🖌️ Where does the text sit on its line?
h2 {
font-size: 32px;
text-align: right;
background-color: red;
color: purple;
} (a) on the right (b) on the left (c) in the middle -
34.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 480px) {
p {
font-size: 8px;
}
} - 35.🧩 Which language makes headings and lists? (a) CSS (b) JavaScript (c) HTML
- 36.💪 Which justify-content value packs boxes at the end? (a) flex-end (b) flex-start (c) space-between (d) center
- 37.⚖️ Which selector is the strongest? (a) an id selector (b) an element selector (c) a class selector
- 38.🔍 Which is the odd one out? (a) adds space around boxes (b) changes the text size (c) rounds box corners (d) reacts to a button click
- 39.What does font-family do? (a) sets the letter colour (b) centres a heading (c) picks the font style (d) makes letters bigger
- 40.🎯 What kind of selector is #top? (a) an element selector (b) a class selector (c) an id selector
Answer key
- colours behind the text
- red
- purple
- width
- CSS
- adds space around boxes
- cyan
- an element selector
- the viewport meta tag
- 600px or narrower
- an id selector
- centres a heading
- True
- 30
- 16
- Yes
- <li id="end">
- True
- p
- a class selector
- 800px or wider
- changes the text size
- #ffff00
- text-align
- blue
- False
- No
- #
- display: flex
- font-size
- flex-start
- adds space around boxes
- on the right
- 12
- HTML
- flex-end
- an id selector
- reacts to a button click
- picks the font style
- an id selector
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids