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 colour is #ffffff? (a) magenta (b) black (c) white (d) cyan
- 2.🌈 Which hex code is red? (a) #ff0000 (b) #00ff00 (c) #ffff00 (d) #0000ff
- 3.🔍 Which is the odd one out? (a) puts a picture on a page (b) reacts to a button click (c) makes headings and lists (d) makes a form box
- 4.True or false: padding is the gap round content. (a) False (b) True
- 5.💪 Which flexbox property turns on flexbox? (a) display: flex (b) justify-content (c) gap (d) align-items
- 6.What does justify-content: space-between 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
- 7.🧩 Which language checks a quiz answer? (a) HTML (b) JavaScript (c) CSS
-
8.🖌️ Where does the text sit on its line?
h2 {
font-size: 36px;
background-color: yellow;
color: white;
text-align: right;
} (a) on the right (b) in the middle (c) on the left - 9.🎨 Which tag holds CSS inside the head? (a) <script> (b) <css> (c) <style> (d) <body>
- 10.True or false: #logo is an element selector. (a) True (b) False
- 11.What does font-weight do? (a) sets the letter colour (b) makes the text bold (c) picks the font style (d) colours behind the text
-
12.🖌️ What colour is behind the letters?
li {
color: black;
background-color: orange;
font-size: 16px;
text-align: center;
} (a) orange (b) black (c) red - 13.🌈 In #rrggbb, which colour do the first two digits give? (a) green (b) blue (c) red (d) black
- 14.🧩 Which language makes headings and lists? (a) JavaScript (b) CSS (c) HTML
-
15.📱 The screen is 540px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (min-width: 480px) {
p {
font-size: 24px;
}
} (a) No (b) Yes - 16.🧩 Which language gives the page structure? (a) HTML (b) CSS (c) JavaScript
- 17.✍️ In color: blue; which part is the property? (a) blue (b) : (c) color (d) ;
- 18.What does background-color do? (a) makes letters bigger (b) colours behind the text (c) makes the text bold (d) picks the font style
- 19.✍️ Which sign ends each CSS declaration? (a) : (b) . (c) , (d) ;
- 20.🎯 Which element does the selector li style? (a) <li class="menu"> (b) <span class="menu"> (c) <div> (d) <p id="end">
- 21.📱 Which tag helps phones show a page at the right size? (a) the title tag (b) the viewport meta tag (c) the br tag (d) the hr tag
-
22.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 320px;
justify-content: space-between;
}
Inside are 3 boxes, each 80px wide (no margins). -
23.📱 The screen is 414px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (min-width: 768px) {
p {
font-size: 16px;
}
} (a) No (b) Yes - 24.🌈 Which colour is rgb(255, 255, 255)? (a) black (b) red (c) cyan (d) white
- 25.🎯 Which sign starts a class selector? (a) . (b) & (c) # (d) @
- 26.🌈 Which colour of light is strongest in rgb(182, 13, 14)? (a) green (b) blue (c) red
- 27.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) 800px or wider (c) turned off (d) exactly 100px
-
28.✍️ What value is given to font-weight in this rule?
h2 {
margin: 10px;
font-weight: bold;
} (a) 2px solid (b) font-weight (c) 300px (d) bold - 29.💪 Which justify-content value puts boxes in the middle? (a) flex-start (b) flex-end (c) space-between (d) center
-
30.🖌️ How big is the text, in px?
p {
color: green;
text-align: left;
font-size: 36px;
background-color: blue;
} - 31.True or false: the border is a solid or dotted edge. (a) True (b) False
-
32.✍️ How many declarations (property: value pairs) are in this rule?
li {
background-color: yellow;
width: 300px;
} - 33.🎯 What kind of selector is p? (a) an id selector (b) a class selector (c) an element selector
-
34.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 768px) {
p {
font-size: 14px;
}
} -
35.🎯 Which CSS selector matches this element?
<div class="note" id="intro">Hello</div> (a) .big (b) #note (c) span (d) div -
36.⚖️ What colour is the text of this element?
<h2 class="star" id="top">Hi</h2>
CSS:
.star { color: black; }
h2 { color: red; } (a) orange (b) red (c) black (d) white -
37.⚖️ What colour is the text of this element?
<h2 class="box" id="main">Hi</h2>
CSS:
#main { color: white; }
#main { color: black; } (a) white (b) orange (c) red (d) black -
38.🖌️ Where does the text sit on its line?
h2 {
text-align: left;
color: yellow;
background-color: green;
font-size: 24px;
} (a) in the middle (b) on the right (c) on the left - 39.🧩 Which language changes the text size? (a) HTML (b) CSS (c) JavaScript
- 40.🧩 Which language changes the page live? (a) JavaScript (b) HTML (c) CSS
Answer key
- white
- #ff0000
- reacts to a button click
- True
- display: flex
- equal gaps, none at ends
- JavaScript
- on the right
- <style>
- False
- makes the text bold
- orange
- red
- HTML
- Yes
- HTML
- color
- colours behind the text
- ;
- <li class="menu">
- the viewport meta tag
- 40
- No
- white
- .
- red
- 800px or wider
- bold
- center
- 36
- True
- 2
- an element selector
- 14
- div
- black
- black
- on the left
- CSS
- JavaScript
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids