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 of light is strongest in rgb(124, 26, 156)? (a) green (b) red (c) blue
- 2.💪 Which flexbox property picks row or column? (a) flex-direction (b) display: flex (c) align-items (d) gap
- 3.🌈 Which colour is rgb(255, 255, 0)? (a) cyan (b) yellow (c) black (d) blue
-
4.✍️ How many declarations (property: value pairs) are in this rule?
h1 {
margin: 10px;
font-size: 20px;
background-color: yellow;
} - 5.✍️ Which sign ends each CSS declaration? (a) . (b) : (c) , (d) ;
- 6.💪 Which flexbox property lines boxes up across? (a) align-items (b) display: flex (c) gap (d) justify-content
- 7.Which of these does CSS do? (a) counts down a timer (b) reacts to a button click (c) gives the page structure (d) changes the text size
- 8.What does font-size do? (a) makes letters bigger (b) colours behind the text (c) makes the text bold (d) picks the font style
- 9.🧩 Which language adds space around boxes? (a) CSS (b) JavaScript (c) HTML
- 10.🌈 In #00000a the blue part is the hex number 0a. What is it as a normal number?
- 11.True or false: the content is a solid or dotted edge. (a) True (b) False
- 12.🎯 Which element does the selector h2 style? (a) <span id="logo"> (b) <li> (c) <h2 class="big"> (d) <div class="big">
- 13.📱 Which tag helps phones show a page at the right size? (a) the br tag (b) the title tag (c) the viewport meta tag (d) the hr tag
-
14.⚖️ What colour is the text of this element?
<p class="star" id="logo">Hi</p>
CSS:
#logo { color: blue; }
#logo { color: black; } (a) black (b) red (c) green (d) blue -
15.⚖️ What colour is the text of this element?
<h1 class="red" id="logo">Hi</h1>
CSS:
.red { color: yellow; }
.red { color: red; } (a) black (b) yellow (c) purple (d) red - 16.📱 What does a media query check? (a) the page title (b) the screen width (c) the battery level (d) the time of day
- 17.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 3 (b) 4 (c) 2 (d) 6
-
18.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (max-width: 600px) {
p {
font-size: 18px;
}
} (a) No (b) Yes -
19.⚖️ What colour is the text of this element?
<p class="big" id="main">Hi</p>
CSS:
.big { color: yellow; }
#main { color: purple; } (a) yellow (b) black (c) blue (d) purple -
20.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 340px;
justify-content: flex-start;
}
Inside are 3 boxes, each 100px wide (no margins). - 21.🧩 Which language puts a picture on a page? (a) CSS (b) JavaScript (c) HTML
- 22.✍️ Which sign goes between a property and its value? (a) ; (b) : (c) = (d) -
- 23.Which of these does CSS do? (a) changes the page live (b) counts down a timer (c) makes a link (d) lays out the page
-
24.📱 The screen is 1100px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 1024px) {
p {
font-size: 14px;
}
} (a) Yes (b) No - 25.Which of these is the border? (a) the text or picture (b) space inside the border (c) space outside the border (d) a solid or dotted edge
- 26.🌈 What is the biggest number one colour can have in rgb()? (a) 100 (b) 1000 (c) 99 (d) 255
-
27.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 230px;
justify-content: flex-end;
}
Inside are 2 boxes, each 80px wide (no margins). -
28.🎯 Which CSS selector matches this element?
<li class="box" id="hero">Hello</li> (a) #box (b) .hero (c) .star (d) li -
29.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 60px;
padding: 10px;
border: 3px solid black;
margin: 15px;
} - 30.🌈 In #630000 the red part is the hex number 63. What is it as a normal number?
- 31.True or false: HTML changes the text size. (a) False (b) True
-
32.🖌️ What colour are the letters?
li {
background-color: yellow;
color: red;
text-align: right;
font-size: 16px;
} (a) yellow (b) red (c) orange - 33.🌈 Which colour is #00ffff? (a) bright green (b) red (c) blue (d) cyan
- 34.🌈 In #890000 the red part is the hex number 89. What is it as a normal number?
-
35.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 90px;
padding: 5px;
border: 4px solid black;
margin: 0px;
} -
36.📱 The screen is 820px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 768px) {
p {
font-size: 8px;
}
} (a) Yes (b) No -
37.⚖️ What colour is the text of this element?
<p class="menu" id="end">Hi</p>
CSS:
p { color: yellow; }
#end { color: red; } (a) white (b) purple (c) red (d) yellow - 38.Which of these does CSS do? (a) sets colours and fonts (b) makes a link (c) changes the page live (d) gives the page structure
- 39.🔍 Which is the odd one out? (a) sets colours and fonts (b) changes the text size (c) rounds box corners (d) makes a link
- 40.Which of these does HTML do? (a) makes a form box (b) sets colours and fonts (c) adds space around boxes (d) checks a quiz answer
Answer key
- blue
- flex-direction
- yellow
- 3
- ;
- align-items
- changes the text size
- makes letters bigger
- CSS
- 10
- False
- <h2 class="big">
- the viewport meta tag
- black
- red
- the screen width
- 3
- Yes
- purple
- 40
- HTML
- :
- lays out the page
- No
- a solid or dotted edge
- 255
- 70
- li
- 116
- 99
- False
- red
- cyan
- 137
- 108
- No
- red
- sets colours and fonts
- makes a link
- makes a form box
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids