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 CSS selector matches this element?
<li class="star" id="intro">Hello</li> (a) #intro (b) .intro (c) #star (d) #main -
2.⚖️ What colour is the text of this element?
<p class="menu" id="logo">Hi</p>
CSS:
#logo { color: yellow; }
#logo { color: blue; } (a) orange (b) green (c) yellow (d) blue -
3.🎯 Which CSS selector matches this element?
<div class="menu" id="top">Hello</div> (a) span (b) .note (c) #intro (d) div -
4.🖌️ Where does the text sit on its line?
li {
text-align: right;
color: green;
background-color: black;
font-size: 12px;
} (a) on the left (b) on the right (c) in the middle - 5.📱 max-width: 600px applies when the screen is ___. (a) exactly 1000px (b) turned off (c) 600px or wider (d) 600px or narrower
-
6.🖌️ What colour is behind the letters?
li {
font-size: 12px;
color: yellow;
text-align: right;
background-color: black;
} (a) blue (b) black (c) yellow -
7.🖌️ What colour are the letters?
h1 {
text-align: center;
background-color: green;
font-size: 24px;
color: red;
} (a) green (b) red (c) orange - 8.🔍 Which is the odd one out? (a) adds space around boxes (b) sets colours and fonts (c) puts a picture on a page (d) rounds box corners
-
9.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (min-width: 600px) {
p {
font-size: 14px;
}
} - 10.True or false: the border is the gap to other boxes. (a) True (b) False
- 11.What does font-family do? (a) makes letters bigger (b) centres a heading (c) sets the letter colour (d) picks the font style
-
12.✍️ How many declarations (property: value pairs) are in this rule?
h1 {
font-style: italic;
text-align: center;
width: 300px;
} - 13.What does font-size do? (a) makes letters bigger (b) sets the letter colour (c) colours behind the text (d) centres a heading
-
14.✍️ Which property is set to red in this rule?
body {
background-color: yellow;
color: red;
} (a) color (b) text-align (c) red (d) font-size -
15.✍️ How many declarations (property: value pairs) are in this rule?
body {
color: red;
} -
16.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 480px) {
p {
font-size: 28px;
}
} - 17.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) turned off (c) 800px or wider (d) exactly 100px
- 18.🌈 In #980000 the red part is the hex number 98. What is it as a normal number?
-
19.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (min-width: 600px) {
p {
font-size: 18px;
}
} - 20.🌈 Which colour is #000000? (a) magenta (b) blue (c) black (d) white
- 21.What does background-color do? (a) centres a heading (b) picks the font style (c) sets the letter colour (d) colours behind the text
-
22.⚖️ What colour is the text of this element?
<h1 class="menu" id="top">Hi</h1>
CSS:
h1 { color: white; }
h1 { color: green; } (a) purple (b) white (c) green (d) red - 23.🖌️ Which CSS property makes the text bold? (a) font-size (b) font-family (c) font-weight (d) color
-
24.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 180px;
justify-content: flex-start;
}
Inside are 2 boxes, each 80px wide (no margins). -
25.⚖️ What colour is the text of this element?
<h1 class="note" id="end">Hi</h1>
CSS:
#end { color: blue; }
#end { color: white; } (a) red (b) white (c) blue (d) green -
26.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 400px;
justify-content: space-between;
}
Inside are 3 boxes, each 80px wide (no margins). -
27.🎯 Which CSS selector matches this element?
<div class="menu" id="intro">Hello</div> (a) #menu (b) .menu (c) #main (d) span - 28.📱 What does a media query check? (a) the battery level (b) the screen width (c) the page title (d) the time of day
- 29.🧩 Which language shows a pop-up message? (a) HTML (b) CSS (c) JavaScript
- 30.🎨 What does CSS stand for? (a) Creative Sheet System (b) Colourful Site Styles (c) Computer Style Sheets (d) Cascading Style Sheets
- 31.✍️ Which sign ends each CSS declaration? (a) . (b) , (c) ; (d) :
- 32.True or false: #logo is an id selector. (a) True (b) False
- 33.True or false: the content is the line round the box. (a) True (b) False
- 34.🎨 Which tag connects an outside CSS file? (a) <link> (b) <a> (c) <img> (d) <css>
-
35.⚖️ What colour is the text of this element?
<h1 class="note" id="main">Hi</h1>
CSS:
#main { color: yellow; }
h1 { color: black; } (a) black (b) yellow (c) orange (d) green - 36.🌈 In #7e0000 the red part is the hex number 7e. What is it as a normal number?
-
37.🖌️ What colour are the letters?
h1 {
color: blue;
font-size: 16px;
text-align: right;
background-color: green;
} (a) green (b) red (c) blue -
38.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 120px;
justify-content: space-between;
}
Inside are 2 boxes, each 40px wide (no margins). - 39.True or false: CSS rounds box corners. (a) False (b) True
-
40.✍️ What value is given to margin in this rule?
p {
font-size: 20px;
margin: 10px;
border: 2px solid;
} (a) 10px (b) margin (c) bold (d) 8px
Answer key
- #intro
- blue
- div
- on the right
- 600px or narrower
- black
- red
- puts a picture on a page
- 12
- False
- picks the font style
- 3
- makes letters bigger
- color
- 1
- 24
- 800px or wider
- 152
- 18
- black
- colours behind the text
- green
- font-weight
- 20
- white
- 80
- .menu
- the screen width
- JavaScript
- Cascading Style Sheets
- ;
- True
- False
- <link>
- yellow
- 126
- blue
- 40
- True
- 10px
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids