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 selector is the weakest? (a) a class selector (b) an element selector (c) an id selector
-
2.🖌️ What colour are the letters?
p {
background-color: black;
font-size: 36px;
text-align: center;
color: blue;
} (a) black (b) blue (c) red - 3.🎨 Which tag holds CSS inside the head? (a) <body> (b) <css> (c) <style> (d) <script>
-
4.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 100px;
padding: 20px;
border: 1px solid black;
margin: 10px;
} - 5.What does justify-content: flex-start do? (a) packs boxes at the end (b) puts boxes in the middle (c) packs boxes at the start (d) equal gaps, none at ends
-
6.🎯 Which CSS selector matches this element?
<span class="note" id="logo">Hello</span> (a) .big (b) span (c) p (d) #note - 7.What does justify-content: center do? (a) puts boxes in the middle (b) equal gaps, none at ends (c) packs boxes at the end (d) packs boxes at the start
-
8.🖌️ What colour are the letters?
h1 {
background-color: blue;
color: orange;
font-size: 36px;
text-align: center;
} (a) green (b) blue (c) orange - 9.🌈 Which colour is rgb(255, 0, 255)? (a) red (b) blue (c) cyan (d) magenta
-
10.✍️ How many declarations (property: value pairs) are in this rule?
li {
color: red;
font-style: italic;
padding: 8px;
border: 2px solid;
} -
11.⚖️ What colour is the text of this element?
<h2 class="red" id="logo">Hi</h2>
CSS:
.red { color: yellow; }
#logo { color: blue; } (a) black (b) yellow (c) green (d) blue -
12.🖌️ What colour are the letters?
li {
font-size: 32px;
color: black;
text-align: right;
background-color: green;
} (a) blue (b) black (c) green - 13.🧩 Which language makes a form box? (a) JavaScript (b) HTML (c) CSS
- 14.True or false: HTML makes a link. (a) False (b) True
- 15.🧩 Which language lays out the page? (a) HTML (b) JavaScript (c) CSS
- 16.🌈 In #380000 the red part is the hex number 38. What is it as a normal number?
- 17.💪 Which justify-content value packs boxes at the start? (a) flex-end (b) center (c) space-between (d) flex-start
-
18.🖌️ What colour is behind the letters?
p {
font-size: 16px;
background-color: orange;
color: red;
text-align: center;
} (a) yellow (b) orange (c) red - 19.🎯 What kind of selector is .big? (a) an element selector (b) a class selector (c) an id selector
-
20.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 80px;
padding: 10px;
border: 1px solid black;
margin: 20px;
} -
21.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (min-width: 480px) {
p {
font-size: 22px;
}
} -
22.🖌️ Where does the text sit on its line?
h1 {
background-color: black;
font-size: 24px;
color: red;
text-align: right;
} (a) on the left (b) in the middle (c) on the right - 23.🎯 What kind of selector is #main? (a) an element selector (b) a class selector (c) an id selector
- 24.🖌️ Which CSS property makes letters bigger? (a) font-family (b) font-weight (c) color (d) font-size
-
25.🖌️ What colour is behind the letters?
h1 {
font-size: 16px;
background-color: red;
text-align: right;
color: green;
} (a) blue (b) red (c) green - 26.🌈 In #rrggbb, which colour do the last two digits give? (a) white (b) blue (c) green (d) red
-
27.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 200px;
padding: 30px;
border: 1px solid black;
margin: 15px;
} -
28.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 1024px) {
p {
font-size: 10px;
}
} (a) Yes (b) No -
29.⚖️ What colour is the text of this element?
<p class="big" id="logo">Hi</p>
CSS:
.big { color: purple; }
#logo { color: green; } (a) orange (b) white (c) green (d) purple -
30.🎯 Which CSS selector matches this element?
<span class="menu" id="intro">Hello</span> (a) #menu (b) #main (c) .intro (d) #intro - 31.📦 In the box model, which part is the text or picture? (a) margin (b) border (c) padding (d) content
- 32.True or false: body is an element selector. (a) False (b) True
- 33.True or false: #logo is an id selector. (a) False (b) True
-
34.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 150px;
padding: 20px;
border: 1px solid black;
margin: 10px;
} - 35.🌈 In #840000 the red part is the hex number 84. What is it as a normal number?
- 36.True or false: JavaScript counts down a timer. (a) False (b) True
-
37.✍️ How many declarations (property: value pairs) are in this rule?
h1 {
margin: 10px;
} -
38.⚖️ What colour is the text of this element?
<p class="note" id="top">Hi</p>
CSS:
p { color: orange; }
p { color: yellow; } (a) green (b) orange (c) black (d) yellow - 39.🎨 What does CSS stand for? (a) Colourful Site Styles (b) Creative Sheet System (c) Cascading Style Sheets (d) Computer Style Sheets
-
40.🖌️ Where does the text sit on its line?
h1 {
background-color: black;
color: blue;
text-align: left;
font-size: 20px;
} (a) on the right (b) on the left (c) in the middle
Answer key
- an element selector
- blue
- <style>
- 162
- packs boxes at the start
- span
- puts boxes in the middle
- orange
- magenta
- 4
- blue
- black
- HTML
- True
- CSS
- 56
- flex-start
- orange
- a class selector
- 102
- 20
- on the right
- an id selector
- font-size
- red
- blue
- 292
- Yes
- green
- #intro
- content
- True
- True
- 212
- 132
- True
- 1
- yellow
- Cascading Style Sheets
- on the left
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids