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.⚖️ 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
-
2.⚖️ What colour is the text of this element?
<h2 class="star" id="end">Hi</h2>
CSS:
#end { color: purple; }
#end { color: red; } (a) yellow (b) orange (c) purple (d) red - 3.💪 Which justify-content value packs boxes at the start? (a) flex-start (b) space-between (c) flex-end (d) center
- 4.📱 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
- 5.🖌️ Which CSS property colours behind the text? (a) background-color (b) font-family (c) color (d) text-align
-
6.🎯 Which CSS selector matches this element?
<h1 class="red" id="main">Hello</h1> (a) #logo (b) .main (c) .red (d) #red - 7.True or false: JavaScript makes a form box. (a) True (b) False
-
8.🎯 Which CSS selector matches this element?
<span class="big" id="end">Hello</span> (a) .end (b) p (c) #end (d) .red - 9.🧩 Which language sets colours and fonts? (a) CSS (b) HTML (c) JavaScript
- 10.🎯 Which element does the selector h2 style? (a) <li> (b) <h2 class="menu"> (c) <div class="menu"> (d) <span id="main">
- 11.🧩 Which language makes headings and lists? (a) HTML (b) CSS (c) JavaScript
- 12.🎯 Which sign starts a class selector? (a) & (b) # (c) . (d) @
- 13.🖌️ Which CSS property picks the font style? (a) text-align (b) font-family (c) background-color (d) color
-
14.🖌️ Where does the text sit on its line?
p {
text-align: center;
font-size: 20px;
color: red;
background-color: white;
} (a) in the middle (b) on the left (c) on the right - 15.True or false: the content is a solid or dotted edge. (a) True (b) False
- 16.🌈 Which colour is #0000ff? (a) cyan (b) red (c) blue (d) bright green
- 17.🌈 Which hex code is yellow? (a) #0000ff (b) #00ffff (c) #ffff00 (d) #ff0000
- 18.💪 Which justify-content value packs boxes at the end? (a) center (b) flex-start (c) flex-end (d) space-between
- 19.📱 max-width: 600px applies when the screen is ___. (a) turned off (b) 600px or wider (c) exactly 1000px (d) 600px or narrower
- 20.✍️ Which sign goes between a property and its value? (a) ; (b) - (c) = (d) :
- 21.What does text-align do? (a) sets the letter colour (b) colours behind the text (c) picks the font style (d) centres a heading
-
22.⚖️ What colour is the text of this element?
<h2 class="big" id="end">Hi</h2>
CSS:
.big { color: red; }
h2 { color: blue; } (a) red (b) blue (c) black (d) green -
23.⚖️ What colour is the text of this element?
<h2 class="red" id="logo">Hi</h2>
CSS:
#logo { color: green; }
h2 { color: blue; }
.red { color: black; } (a) blue (b) green (c) black (d) white - 24.Which of these does HTML do? (a) reacts to a button click (b) lays out the page (c) rounds box corners (d) makes headings and lists
- 25.⚖️ Which selector is the strongest? (a) an element selector (b) a class selector (c) an id selector
- 26.🖌️ Which CSS property makes letters bigger? (a) font-family (b) font-size (c) color (d) background-color
- 27.True or false: padding is space inside the border. (a) False (b) True
- 28.Which of these does CSS do? (a) gives the page structure (b) shows a pop-up message (c) makes headings and lists (d) adds space around boxes
- 29.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 3 (b) 6 (c) 2 (d) 4
-
30.⚖️ What colour is the text of this element?
<h1 class="box" id="main">Hi</h1>
CSS:
#main { color: orange; }
h1 { color: black; }
.box { color: blue; } (a) green (b) orange (c) blue (d) black - 31.Which of these does JavaScript do? (a) shows a pop-up message (b) makes a link (c) makes headings and lists (d) puts a picture on a page
-
32.✍️ What is the selector in this CSS rule?
.note {
width: 300px;
font-style: italic;
font-size: 20px;
padding: 8px;
} (a) italic (b) .note (c) #top (d) width -
33.🖌️ What colour is behind the letters?
li {
text-align: right;
color: blue;
font-size: 12px;
background-color: purple;
} (a) black (b) purple (c) blue -
34.🎯 Which CSS selector matches this element?
<h2 class="box" id="top">Hello</h2> (a) #box (b) .top (c) .star (d) h2 -
35.📱 The screen is 1100px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (min-width: 480px) {
p {
font-size: 24px;
}
} (a) Yes (b) No - 36.💪 Which flexbox property picks row or column? (a) justify-content (b) flex-direction (c) display: flex (d) gap
- 37.True or false: the content is space outside the border. (a) True (b) False
-
38.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (min-width: 1024px) {
p {
font-size: 14px;
}
} (a) No (b) Yes - 39.What does color do? (a) sets the letter colour (b) makes the text bold (c) picks the font style (d) makes letters bigger
-
40.🖌️ What colour are the letters?
li {
color: black;
font-size: 32px;
background-color: purple;
text-align: center;
} (a) black (b) purple (c) orange
Answer key
- the later one
- red
- flex-start
- the viewport meta tag
- background-color
- .red
- False
- #end
- CSS
- <h2 class="menu">
- HTML
- .
- font-family
- in the middle
- False
- blue
- #ffff00
- flex-end
- 600px or narrower
- :
- centres a heading
- red
- green
- makes headings and lists
- an id selector
- font-size
- True
- adds space around boxes
- 3
- orange
- shows a pop-up message
- .note
- purple
- h2
- Yes
- flex-direction
- False
- No
- sets the letter colour
- black
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids