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 sign starts an id selector? (a) . (b) # (c) @ (d) &
- 2.🌈 Which colour is #ff00ff? (a) bright green (b) magenta (c) white (d) black
- 3.🎯 Which element does the selector #end style? (a) <p id="hero"> (b) <h1 class="star"> (c) <p id="end"> (d) <p class="end">
-
4.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 320px;
justify-content: flex-start;
}
Inside are 3 boxes, each 80px wide (no margins). -
5.✍️ What is the selector in this CSS rule?
.note {
border: 2px solid;
font-size: 20px;
padding: 8px;
} (a) #top (b) .note (c) border (d) 20px - 6.💪 Which justify-content value equal gaps, none at ends? (a) flex-start (b) center (c) space-between (d) flex-end
- 7.💪 Which justify-content value packs boxes at the end? (a) center (b) space-between (c) flex-end (d) flex-start
-
8.🎯 Which CSS selector matches this element?
<div class="note" id="logo">Hello</div> (a) #note (b) #end (c) div (d) .logo -
9.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 768px) {
p {
font-size: 6px;
}
} - 10.🔍 Which is the odd one out? (a) makes a form box (b) counts down a timer (c) makes headings and lists (d) makes a link
- 11.💪 Which justify-content value puts boxes in the middle? (a) center (b) flex-start (c) flex-end (d) space-between
-
12.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 190px;
justify-content: space-between;
}
Inside are 2 boxes, each 60px wide (no margins). -
13.🖌️ What colour is behind the letters?
p {
color: black;
font-size: 36px;
text-align: left;
background-color: green;
} (a) black (b) white (c) green - 14.🌈 Which colour is rgb(255, 255, 0)? (a) yellow (b) black (c) blue (d) red
- 15.🎯 Which element does the selector h1 style? (a) <div id="top"> (b) <h2> (c) <h1 class="star"> (d) <li class="star">
- 16.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) the later one (c) the first one (d) neither
- 17.✍️ CSS declarations go inside which brackets? (a) < > (b) { } (c) ( ) (d) [ ]
-
18.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 290px;
padding: 25px;
border: 2px solid black;
margin: 0px;
} -
19.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 480px) {
p {
font-size: 12px;
}
} - 20.🌈 Which hex code is cyan? (a) #ff0000 (b) #00ffff (c) #00ff00 (d) #ff00ff
- 21.🌈 Which colour is rgb(0, 255, 255)? (a) yellow (b) cyan (c) blue (d) magenta
- 22.🌈 Which colour is #ffff00? (a) red (b) blue (c) yellow (d) magenta
-
23.⚖️ What colour is the text of this element?
<h1 class="menu" id="main">Hi</h1>
CSS:
.menu { color: purple; }
.menu { color: black; } (a) purple (b) black (c) white (d) yellow -
24.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 768px) {
p {
font-size: 10px;
}
} -
25.📱 The screen is 540px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (max-width: 1024px) {
p {
font-size: 14px;
}
} (a) No (b) Yes -
26.⚖️ What colour is the text of this element?
<p class="red" id="end">Hi</p>
CSS:
.red { color: orange; }
.red { color: yellow; } (a) blue (b) green (c) yellow (d) orange - 27.✍️ In color: blue; which part is the value? (a) color (b) ; (c) : (d) blue
- 28.🌈 Hex digits go 0 to 9, then A to which letter? (a) G (b) J (c) Z (d) F
- 29.🎨 A CSS file usually ends with which extension? (a) .png (b) .css (c) .html (d) .js
-
30.🖌️ What colour are the letters?
li {
text-align: center;
background-color: purple;
color: yellow;
font-size: 40px;
} (a) purple (b) black (c) yellow - 31.True or false: JavaScript adds space around boxes. (a) False (b) True
-
32.✍️ What is the selector in this CSS rule?
.box {
font-style: italic;
color: red;
padding: 8px;
} (a) .box (b) font-style (c) red (d) h2 - 33.🌈 Which colour of light is strongest in rgb(251, 71, 122)? (a) green (b) red (c) blue
-
34.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 260px;
justify-content: center;
}
Inside are 2 boxes, each 50px wide (no margins). - 35.What does justify-content: flex-start do? (a) packs boxes at the end (b) puts boxes in the middle (c) equal gaps, none at ends (d) packs boxes at the start
-
36.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 480px) {
p {
font-size: 6px;
}
} - 37.📱 min-width: 800px applies when the screen is ___. (a) exactly 100px (b) 800px or wider (c) turned off (d) 800px or narrower
-
38.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (min-width: 768px) {
p {
font-size: 14px;
}
} - 39.🌈 Which colour of light is strongest in rgb(30, 207, 53)? (a) green (b) blue (c) red
- 40.💪 Which flexbox property spaces boxes along a row? (a) justify-content (b) display: flex (c) gap (d) align-items
Answer key
- #
- magenta
- <p id="end">
- 80
- .note
- space-between
- flex-end
- div
- 12
- counts down a timer
- center
- 70
- green
- yellow
- <h1 class="star">
- the later one
- { }
- 344
- 16
- #00ffff
- cyan
- yellow
- black
- 10
- Yes
- yellow
- blue
- F
- .css
- yellow
- False
- .box
- red
- 80
- packs boxes at the start
- 12
- 800px or wider
- 12
- green
- justify-content
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids