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.True or false: li is a class selector. (a) False (b) True
-
2.🖌️ How big is the text, in px?
p {
color: purple;
font-size: 12px;
text-align: left;
background-color: white;
} - 3.🧩 Which language changes the text size? (a) HTML (b) JavaScript (c) CSS
-
4.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 180px;
justify-content: flex-end;
}
Inside are 2 boxes, each 60px wide (no margins). - 5.📱 min-width: 800px applies when the screen is ___. (a) turned off (b) 800px or wider (c) exactly 100px (d) 800px or narrower
- 6.🌈 In #rrggbb, which colour do the last two digits give? (a) white (b) green (c) red (d) blue
- 7.🔍 Which is the odd one out? (a) makes a link (b) reacts to a button click (c) changes the page live (d) shows a pop-up message
- 8.🖌️ Which CSS property makes the text bold? (a) text-align (b) color (c) background-color (d) font-weight
-
9.✍️ Which property is set to italic in this rule?
p {
font-style: italic;
border: 2px solid;
width: 300px;
} (a) font-size (b) color (c) italic (d) font-style - 10.🖌️ Which CSS property makes letters bigger? (a) text-align (b) color (c) font-size (d) font-family
- 11.🌈 Which colour is rgb(0, 0, 255)? (a) red (b) magenta (c) blue (d) yellow
-
12.📱 The screen is 1100px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (max-width: 480px) {
p {
font-size: 20px;
}
} (a) No (b) Yes - 13.Which of these does CSS do? (a) puts a picture on a page (b) checks a quiz answer (c) adds space around boxes (d) changes the page live
- 14.Which of these does CSS do? (a) checks a quiz answer (b) gives the page structure (c) lays out the page (d) shows a pop-up message
-
15.🖌️ How big is the text, in px?
p {
text-align: right;
background-color: green;
font-size: 20px;
color: yellow;
} - 16.🧩 Which language reacts to a button click? (a) JavaScript (b) CSS (c) HTML
-
17.⚖️ What colour is the text of this element?
<p class="star" id="hero">Hi</p>
CSS:
.star { color: green; }
.star { color: orange; } (a) red (b) orange (c) yellow (d) green - 18.🔍 Which is the odd one out? (a) reacts to a button click (b) makes a form box (c) gives the page structure (d) puts a picture on a page
-
19.✍️ Which property is set to 2px solid in this rule?
h2 {
font-style: italic;
border: 2px solid;
margin: 10px;
} (a) 2px solid (b) width (c) border (d) font-style -
20.🖌️ What colour is behind the letters?
h1 {
color: black;
background-color: blue;
font-size: 36px;
text-align: center;
} (a) blue (b) white (c) black -
21.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 270px;
justify-content: flex-end;
}
Inside are 2 boxes, each 100px wide (no margins). - 22.🌈 In #009f00 the green part is the hex number 9f. What is it as a normal number?
- 23.🔍 Which is the odd one out? (a) gives the page structure (b) shows a pop-up message (c) makes headings and lists (d) makes a form box
- 24.🧩 Which language makes a form box? (a) JavaScript (b) CSS (c) HTML
- 25.Which of these does HTML do? (a) puts a picture on a page (b) checks a quiz answer (c) adds space around boxes (d) sets colours and fonts
-
26.⚖️ What colour is the text of this element?
<h2 class="note" id="top">Hi</h2>
CSS:
.note { color: green; }
h2 { color: black; } (a) black (b) yellow (c) blue (d) green - 27.🌈 Which colour is #00ff00? (a) yellow (b) bright green (c) cyan (d) red
-
28.⚖️ What colour is the text of this element?
<p class="menu" id="intro">Hi</p>
CSS:
#intro { color: purple; }
p { color: blue; }
.menu { color: red; } (a) purple (b) blue (c) yellow (d) red -
29.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 230px;
justify-content: flex-start;
}
Inside are 4 boxes, each 50px wide (no margins). -
30.⚖️ What colour is the text of this element?
<h1 class="big" id="intro">Hi</h1>
CSS:
.big { color: black; }
#intro { color: red; }
h1 { color: yellow; } (a) black (b) orange (c) red (d) yellow - 31.True or false: .star is an element selector. (a) False (b) True
-
32.⚖️ What colour is the text of this element?
<h2 class="star" id="main">Hi</h2>
CSS:
.star { color: yellow; }
.star { color: green; } (a) yellow (b) orange (c) red (d) green -
33.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 160px;
padding: 10px;
border: 2px solid black;
margin: 0px;
} - 34.🌈 Hex digits go 0 to 9, then A to which letter? (a) F (b) G (c) J (d) Z
-
35.🖌️ How big is the text, in px?
li {
font-size: 40px;
color: yellow;
background-color: red;
text-align: center;
} - 36.🎯 Which element does the selector .red style? (a) <div id="red"> (b) <span class="star"> (c) <div class="box"> (d) <div class="red">
- 37.🌈 What is the biggest number one colour can have in rgb()? (a) 1000 (b) 99 (c) 100 (d) 255
-
38.✍️ How many declarations (property: value pairs) are in this rule?
p {
text-align: center;
margin: 10px;
width: 300px;
color: red;
} - 39.Which of these does JavaScript do? (a) puts a picture on a page (b) reacts to a button click (c) sets colours and fonts (d) makes a link
- 40.🎯 What kind of selector is .note? (a) an element selector (b) a class selector (c) an id selector
Answer key
- False
- 12
- CSS
- 60
- 800px or wider
- blue
- makes a link
- font-weight
- font-style
- font-size
- blue
- No
- adds space around boxes
- lays out the page
- 20
- JavaScript
- orange
- reacts to a button click
- border
- blue
- 70
- 159
- shows a pop-up message
- HTML
- puts a picture on a page
- green
- bright green
- purple
- 30
- red
- False
- green
- 184
- F
- 40
- <div class="red">
- 255
- 4
- reacts to a button click
- a class selector
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids