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.🖌️ How big is the text, in px?
h1 {
text-align: left;
color: orange;
font-size: 40px;
background-color: white;
} - 2.What does justify-content: flex-start do? (a) puts boxes in the middle (b) packs boxes at the end (c) packs boxes at the start (d) equal gaps, none at ends
- 3.💪 Which justify-content value puts boxes in the middle? (a) space-between (b) center (c) flex-end (d) flex-start
- 4.🌈 Which colour is rgb(0, 255, 0)? (a) white (b) cyan (c) magenta (d) bright green
- 5.🌈 Which colour of light is strongest in rgb(171, 74, 16)? (a) blue (b) green (c) red
- 6.True or false: CSS makes headings and lists. (a) False (b) True
-
7.⚖️ What colour is the text of this element?
<h1 class="note" id="main">Hi</h1>
CSS:
#main { color: black; }
#main { color: green; } (a) black (b) red (c) white (d) green - 8.🎯 Which element does the selector #intro style? (a) <span class="note"> (b) <div id="intro"> (c) <div class="intro"> (d) <div id="main">
-
9.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 160px;
justify-content: flex-start;
}
Inside are 2 boxes, each 40px wide (no margins). - 10.📱 min-width: 800px applies when the screen is ___. (a) exactly 100px (b) 800px or narrower (c) turned off (d) 800px or wider
- 11.📱 What does a media query check? (a) the screen width (b) the time of day (c) the battery level (d) the page title
- 12.🧩 Which language counts down a timer? (a) HTML (b) JavaScript (c) CSS
- 13.What does justify-content: center do? (a) packs boxes at the end (b) packs boxes at the start (c) equal gaps, none at ends (d) puts boxes in the middle
-
14.🖌️ What colour are the letters?
h2 {
font-size: 36px;
text-align: right;
background-color: purple;
color: black;
} (a) black (b) red (c) purple - 15.🌈 In #000074 the blue part is the hex number 74. What is it as a normal number?
-
16.✍️ How many declarations (property: value pairs) are in this rule?
h2 {
font-weight: bold;
color: red;
} - 17.🧩 Which language lays out the page? (a) JavaScript (b) CSS (c) HTML
- 18.🎨 What does CSS stand for? (a) Colourful Site Styles (b) Computer Style Sheets (c) Cascading Style Sheets (d) Creative Sheet System
-
19.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 460px;
justify-content: flex-end;
}
Inside are 4 boxes, each 100px wide (no margins). - 20.🔍 Which is the odd one out? (a) rounds box corners (b) sets colours and fonts (c) lays out the page (d) makes headings and lists
-
21.✍️ Which property is set to 300px in this rule?
.box {
width: 300px;
color: red;
background-color: yellow;
font-size: 20px;
} (a) width (b) font-style (c) color (d) 300px - 22.🌈 Which colour is #ffffff? (a) yellow (b) blue (c) red (d) white
- 23.✍️ In color: blue; which part is the property? (a) ; (b) : (c) color (d) blue
- 24.🖌️ Which CSS property colours behind the text? (a) background-color (b) text-align (c) font-size (d) font-family
- 25.💪 Which flexbox property turns on flexbox? (a) gap (b) align-items (c) justify-content (d) display: flex
- 26.🎨 Which tag holds CSS inside the head? (a) <style> (b) <script> (c) <body> (d) <css>
- 27.🧩 Which language reacts to a button click? (a) HTML (b) CSS (c) JavaScript
-
28.✍️ Which property is set to italic in this rule?
#top {
font-size: 20px;
margin: 10px;
font-style: italic;
background-color: yellow;
} (a) font-style (b) italic (c) font-size (d) color -
29.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 230px;
padding: 25px;
border: 1px solid black;
margin: 0px;
} -
30.🖌️ How big is the text, in px?
li {
text-align: right;
color: green;
font-size: 12px;
background-color: red;
} - 31.What does color do? (a) makes the text bold (b) colours behind the text (c) makes letters bigger (d) sets the letter colour
-
32.✍️ How many declarations (property: value pairs) are in this rule?
#top {
padding: 8px;
border: 2px solid;
color: red;
} -
33.✍️ Which property is set to 10px in this rule?
p {
font-style: italic;
margin: 10px;
} (a) margin (b) font-weight (c) 10px (d) padding -
34.🎯 Which CSS selector matches this element?
<h1 class="star" id="end">Hello</h1> (a) .star (b) .menu (c) #star (d) h2 - 35.True or false: CSS puts a picture on a page. (a) False (b) True
- 36.🧩 Which language changes the page live? (a) CSS (b) JavaScript (c) HTML
-
37.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (min-width: 600px) {
p {
font-size: 26px;
}
} -
38.✍️ How many declarations (property: value pairs) are in this rule?
h1 {
width: 300px;
background-color: yellow;
} -
39.⚖️ What colour is the text of this element?
<p class="red" id="main">Hi</p>
CSS:
#main { color: blue; }
#main { color: green; } (a) green (b) white (c) blue (d) yellow - 40.🌈 Which colour of light is strongest in rgb(202, 34, 109)? (a) red (b) blue (c) green
Answer key
- 40
- packs boxes at the start
- center
- bright green
- red
- False
- green
- <div id="intro">
- 80
- 800px or wider
- the screen width
- JavaScript
- puts boxes in the middle
- black
- 116
- 2
- CSS
- Cascading Style Sheets
- 60
- makes headings and lists
- width
- white
- color
- background-color
- display: flex
- <style>
- JavaScript
- font-style
- 282
- 12
- sets the letter colour
- 3
- margin
- .star
- False
- JavaScript
- 20
- 2
- green
- red
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids