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 hex code is cyan? (a) #ffffff (b) #00ffff (c) #ffff00 (d) #ff00ff
- 2.✍️ CSS declarations go inside which brackets? (a) ( ) (b) [ ] (c) { } (d) < >
- 3.🌈 Hex digits go 0 to 9, then A to which letter? (a) J (b) G (c) F (d) Z
- 4.Which of these does CSS do? (a) shows a pop-up message (b) counts down a timer (c) gives the page structure (d) rounds box corners
-
5.🎯 Which CSS selector matches this element?
<li class="note" id="main">Hello</li> (a) .big (b) .note (c) .main (d) #note - 6.🌈 Which hex code is black? (a) #00ff00 (b) #ffffff (c) #ffff00 (d) #000000
- 7.🌈 Which hex code is bright green? (a) #00ff00 (b) #0000ff (c) #ff0000 (d) #000000
-
8.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 768px) {
p {
font-size: 24px;
}
} - 9.🌈 In #006200 the green part is the hex number 62. What is it as a normal number?
-
10.🖌️ How big is the text, in px?
h2 {
font-size: 24px;
background-color: red;
text-align: right;
color: blue;
} - 11.True or false: .note is a class selector. (a) False (b) True
- 12.What does background-color do? (a) makes letters bigger (b) centres a heading (c) sets the letter colour (d) colours behind the text
- 13.📱 min-width: 800px applies when the screen is ___. (a) exactly 100px (b) 800px or narrower (c) turned off (d) 800px or wider
- 14.📦 In the box model, which part is space inside the border? (a) content (b) margin (c) border (d) padding
-
15.✍️ What value is given to font-size in this rule?
h1 {
font-size: 20px;
color: red;
} (a) center (b) yellow (c) 20px (d) font-size - 16.🧩 Which language changes the page live? (a) CSS (b) HTML (c) JavaScript
-
17.⚖️ What colour is the text of this element?
<p class="red" id="logo">Hi</p>
CSS:
p { color: blue; }
p { color: red; } (a) red (b) green (c) white (d) blue - 18.Which of these does CSS do? (a) counts down a timer (b) makes a form box (c) changes the text size (d) makes headings and lists
- 19.🎯 Which sign starts a class selector? (a) @ (b) & (c) . (d) #
- 20.🔍 Which is the odd one out? (a) sets colours and fonts (b) changes the text size (c) makes headings and lists (d) rounds box corners
-
21.✍️ Which property is set to 300px in this rule?
p {
width: 300px;
color: red;
} (a) font-style (b) 300px (c) width (d) color -
22.🖌️ What colour are the letters?
li {
text-align: right;
font-size: 16px;
color: yellow;
background-color: blue;
} (a) yellow (b) blue (c) green - 23.📱 What does a media query check? (a) the battery level (b) the page title (c) the time of day (d) the screen width
- 24.📦 In the box model, which part is the line round the box? (a) border (b) padding (c) margin (d) content
- 25.💪 Which flexbox property turns on flexbox? (a) align-items (b) display: flex (c) gap (d) justify-content
-
26.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 480px) {
p {
font-size: 28px;
}
} (a) No (b) Yes -
27.⚖️ What colour is the text of this element?
<p class="box" id="main">Hi</p>
CSS:
.box { color: orange; }
p { color: white; }
#main { color: purple; } (a) white (b) black (c) orange (d) purple -
28.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 600px) {
p {
font-size: 18px;
}
} - 29.🖌️ Which CSS property makes the text bold? (a) font-weight (b) text-align (c) font-size (d) font-family
- 30.What does text-align do? (a) centres a heading (b) makes the text bold (c) makes letters bigger (d) sets the letter colour
-
31.✍️ What value is given to background-color in this rule?
p {
font-size: 20px;
text-align: center;
font-weight: bold;
background-color: yellow;
} (a) 10px (b) background-color (c) 8px (d) yellow - 32.🎯 What kind of selector is .menu? (a) an element selector (b) an id selector (c) a class selector
- 33.🌈 In #008200 the green part is the hex number 82. What is it as a normal number?
- 34.🌈 In #006d00 the green part is the hex number 6d. What is it as a normal number?
-
35.✍️ Which property is set to 20px in this rule?
li {
font-size: 20px;
padding: 8px;
} (a) background-color (b) text-align (c) 20px (d) font-size - 36.🌈 Which colour of light is strongest in rgb(111, 18, 152)? (a) blue (b) red (c) green
- 37.🌈 In #1f0000 the red part is the hex number 1f. What is it as a normal number?
- 38.🎨 Which tag connects an outside CSS file? (a) <link> (b) <css> (c) <img> (d) <a>
-
39.✍️ Which property is set to yellow in this rule?
p {
font-style: italic;
background-color: yellow;
margin: 10px;
} (a) yellow (b) padding (c) background-color (d) margin -
40.🖌️ How big is the text, in px?
p {
background-color: black;
text-align: left;
font-size: 24px;
color: green;
}
Answer key
- #00ffff
- { }
- F
- rounds box corners
- .note
- #000000
- #00ff00
- 24
- 98
- 24
- True
- colours behind the text
- 800px or wider
- padding
- 20px
- JavaScript
- red
- changes the text size
- .
- makes headings and lists
- width
- yellow
- the screen width
- border
- display: flex
- No
- purple
- 20
- font-weight
- centres a heading
- yellow
- a class selector
- 130
- 109
- font-size
- blue
- 31
- <link>
- background-color
- 24
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids