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 is the selector in this CSS rule?
#top {
border: 2px solid;
color: red;
} (a) red (b) li (c) border (d) #top -
2.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 150px;
padding: 5px;
border: 5px solid black;
margin: 10px;
} -
3.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 540px;
justify-content: center;
}
Inside are 4 boxes, each 100px wide (no margins). -
4.🖌️ How big is the text, in px?
h2 {
text-align: left;
font-size: 28px;
color: blue;
background-color: purple;
} - 5.🧩 Which language shows a pop-up message? (a) CSS (b) JavaScript (c) HTML
- 6.✍️ In color: blue; which part is the value? (a) : (b) ; (c) color (d) blue
- 7.🌈 Which colour is rgb(0, 255, 0)? (a) bright green (b) black (c) magenta (d) cyan
-
8.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 250px;
justify-content: flex-start;
}
Inside are 4 boxes, each 50px wide (no margins). - 9.🧩 Which language counts down a timer? (a) CSS (b) HTML (c) JavaScript
- 10.✍️ Which sign goes between a property and its value? (a) - (b) ; (c) : (d) =
- 11.🌈 Which colour of light is strongest in rgb(50, 127, 193)? (a) red (b) green (c) blue
- 12.🌈 Which colour is #ffff00? (a) yellow (b) white (c) bright green (d) black
- 13.🌈 What is the biggest number one colour can have in rgb()? (a) 99 (b) 100 (c) 1000 (d) 255
-
14.🖌️ What colour are the letters?
li {
text-align: right;
color: yellow;
font-size: 12px;
background-color: red;
} (a) green (b) red (c) yellow - 15.🎯 Which element does the selector .menu style? (a) <h1 id="menu"> (b) <h2 class="big"> (c) <h1 class="note"> (d) <h1 class="menu">
- 16.📱 Which tag helps phones show a page at the right size? (a) the title tag (b) the viewport meta tag (c) the hr tag (d) the br tag
-
17.✍️ What value is given to border in this rule?
#top {
border: 2px solid;
color: red;
font-size: 20px;
font-weight: bold;
} (a) 300px (b) italic (c) 2px solid (d) border -
18.✍️ What is the selector in this CSS rule?
body {
text-align: center;
padding: 8px;
margin: 10px;
font-weight: bold;
} (a) .box (b) body (c) 8px (d) text-align - 19.Which of these does JavaScript do? (a) changes the text size (b) makes headings and lists (c) rounds box corners (d) counts down a timer
- 20.Which of these does HTML do? (a) counts down a timer (b) checks a quiz answer (c) lays out the page (d) puts a picture on a page
- 21.🌈 In #240000 the red part is the hex number 24. What is it as a normal number?
- 22.🧩 Which language checks a quiz answer? (a) HTML (b) CSS (c) JavaScript
-
23.⚖️ What colour is the text of this element?
<p class="menu" id="end">Hi</p>
CSS:
.menu { color: yellow; }
.menu { color: blue; } (a) orange (b) yellow (c) blue (d) black - 24.✍️ CSS declarations go inside which brackets? (a) ( ) (b) { } (c) < > (d) [ ]
- 25.Which of these does HTML do? (a) sets colours and fonts (b) makes headings and lists (c) shows a pop-up message (d) reacts to a button click
- 26.🎯 Which element does the selector p style? (a) <h1> (b) <p class="note"> (c) <h2 class="note"> (d) <li id="main">
-
27.✍️ How many declarations (property: value pairs) are in this rule?
.box {
border: 2px solid;
margin: 10px;
font-style: italic;
font-size: 20px;
} -
28.✍️ How many declarations (property: value pairs) are in this rule?
.note {
padding: 8px;
} - 29.🌈 Which hex code is magenta? (a) #ff00ff (b) #00ffff (c) #ffffff (d) #0000ff
-
30.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 180px;
justify-content: center;
}
Inside are 4 boxes, each 40px wide (no margins). - 31.Which of these does CSS do? (a) makes headings and lists (b) makes a form box (c) gives the page structure (d) rounds box corners
- 32.🎯 Which element does the selector #main style? (a) <h1 class="note"> (b) <p id="logo"> (c) <p id="main"> (d) <p class="main">
-
33.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 480px) {
p {
font-size: 10px;
}
} - 34.🎯 Which element does the selector #intro style? (a) <span class="intro"> (b) <p class="big"> (c) <span id="intro"> (d) <span id="main">
- 35.🌈 Which hex code is bright green? (a) #ff0000 (b) #ff00ff (c) #00ffff (d) #00ff00
-
36.⚖️ What colour is the text of this element?
<h2 class="red" id="top">Hi</h2>
CSS:
h2 { color: yellow; }
#top { color: blue; }
.red { color: white; } (a) purple (b) yellow (c) white (d) blue -
37.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (min-width: 480px) {
p {
font-size: 20px;
}
} - 38.🌈 Which colour is #ffffff? (a) yellow (b) bright green (c) white (d) blue
-
39.🎯 Which CSS selector matches this element?
<span class="big" id="intro">Hello</span> (a) #main (b) .intro (c) p (d) #intro - 40.💪 Which flexbox property lines boxes up across? (a) align-items (b) flex-direction (c) gap (d) display: flex
Answer key
- #top
- 190
- 70
- 28
- JavaScript
- blue
- bright green
- 50
- JavaScript
- :
- blue
- yellow
- 255
- yellow
- <h1 class="menu">
- the viewport meta tag
- 2px solid
- body
- counts down a timer
- puts a picture on a page
- 36
- JavaScript
- blue
- { }
- makes headings and lists
- <p class="note">
- 4
- 1
- #ff00ff
- 10
- rounds box corners
- <p id="main">
- 10
- <span id="intro">
- #00ff00
- blue
- 20
- white
- #intro
- align-items
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids