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.🌈 In #780000 the red part is the hex number 78. What is it as a normal number?
- 2.✍️ CSS declarations go inside which brackets? (a) [ ] (b) { } (c) ( ) (d) < >
-
3.⚖️ What colour is the text of this element?
<p class="star" id="logo">Hi</p>
CSS:
p { color: blue; }
p { color: green; } (a) yellow (b) orange (c) blue (d) green - 4.What does color do? (a) centres a heading (b) makes the text bold (c) sets the letter colour (d) makes letters bigger
- 5.🧩 Which language reacts to a button click? (a) CSS (b) JavaScript (c) HTML
- 6.🌈 Which colour is #0000ff? (a) white (b) cyan (c) blue (d) yellow
- 7.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the later one (c) the first one (d) the shorter one
- 8.🧩 Which language checks a quiz answer? (a) HTML (b) JavaScript (c) CSS
- 9.Which of these does JavaScript do? (a) checks a quiz answer (b) makes a form box (c) makes a link (d) adds space around boxes
- 10.🎯 Which sign starts an id selector? (a) & (b) # (c) . (d) @
- 11.🎯 What kind of selector is .star? (a) an element selector (b) a class selector (c) an id selector
- 12.🎯 What kind of selector is .card? (a) a class selector (b) an element selector (c) an id selector
- 13.🎯 Which element does the selector p style? (a) <h2 class="big"> (b) <li id="top"> (c) <h1> (d) <p class="big">
-
14.⚖️ What colour is the text of this element?
<p class="big" id="logo">Hi</p>
CSS:
#logo { color: orange; }
.big { color: black; } (a) blue (b) green (c) orange (d) black -
15.🖌️ What colour is behind the letters?
li {
font-size: 28px;
color: red;
background-color: white;
text-align: right;
} (a) white (b) green (c) red - 16.What does justify-content: flex-end do? (a) equal gaps, none at ends (b) puts boxes in the middle (c) packs boxes at the start (d) packs boxes at the end
- 17.🎯 Which element does the selector #intro style? (a) <div id="intro"> (b) <div id="main"> (c) <span class="box"> (d) <div class="intro">
-
18.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 280px;
justify-content: center;
}
Inside are 2 boxes, each 80px wide (no margins). - 19.📱 Which tag helps phones show a page at the right size? (a) the br tag (b) the viewport meta tag (c) the title tag (d) the hr tag
-
20.⚖️ What colour is the text of this element?
<p class="star" id="hero">Hi</p>
CSS:
#hero { color: blue; }
p { color: yellow; }
.star { color: green; } (a) green (b) blue (c) yellow (d) black -
21.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 330px;
justify-content: flex-start;
}
Inside are 3 boxes, each 100px wide (no margins). -
22.⚖️ What colour is the text of this element?
<h2 class="note" id="end">Hi</h2>
CSS:
.note { color: blue; }
.note { color: yellow; } (a) purple (b) yellow (c) white (d) blue - 23.Which of these is the content? (a) space inside the border (b) the text or picture (c) space outside the border (d) a solid or dotted edge
- 24.🌈 Which hex code is yellow? (a) #ff0000 (b) #000000 (c) #ffff00 (d) #ffffff
- 25.🔍 Which is the odd one out? (a) makes headings and lists (b) changes the text size (c) lays out the page (d) sets colours and fonts
- 26.True or false: JavaScript gives the page structure. (a) True (b) False
-
27.🖌️ How big is the text, in px?
li {
font-size: 20px;
text-align: center;
color: black;
background-color: orange;
} -
28.✍️ How many declarations (property: value pairs) are in this rule?
p {
color: red;
} - 29.🔍 Which is the odd one out? (a) makes headings and lists (b) reacts to a button click (c) makes a form box (d) gives the page structure
- 30.🖌️ Which CSS property centres a heading? (a) font-family (b) text-align (c) font-weight (d) color
-
31.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 120px;
justify-content: flex-start;
}
Inside are 2 boxes, each 50px wide (no margins). - 32.🌈 Which colour is #00ffff? (a) white (b) magenta (c) cyan (d) red
- 33.🌈 What is the biggest number one colour can have in rgb()? (a) 99 (b) 255 (c) 1000 (d) 100
- 34.🌈 In #00008d the blue part is the hex number 8d. What is it as a normal number?
- 35.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 6 (b) 4 (c) 3 (d) 2
-
36.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 1024px) {
p {
font-size: 20px;
}
} - 37.🎯 Which sign starts a class selector? (a) # (b) . (c) @ (d) &
-
38.✍️ What is the selector in this CSS rule?
li {
background-color: yellow;
font-weight: bold;
font-style: italic;
} (a) li (b) bold (c) background-color (d) body -
39.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 1024px) {
p {
font-size: 28px;
}
} - 40.🌈 In #rrggbb, which colour do the last two digits give? (a) green (b) white (c) blue (d) red
Answer key
- 120
- { }
- green
- sets the letter colour
- JavaScript
- blue
- the later one
- JavaScript
- checks a quiz answer
- #
- a class selector
- a class selector
- <p class="big">
- orange
- white
- packs boxes at the end
- <div id="intro">
- 60
- the viewport meta tag
- blue
- 30
- yellow
- the text or picture
- #ffff00
- makes headings and lists
- False
- 20
- 1
- reacts to a button click
- text-align
- 20
- cyan
- 255
- 141
- 3
- 16
- .
- li
- 24
- blue
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids