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 strongest? (a) an element selector (b) an id selector (c) a class selector
-
2.📱 The screen is 414px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 600px) {
p {
font-size: 10px;
}
} (a) No (b) Yes -
3.🖌️ Where does the text sit on its line?
li {
color: green;
text-align: right;
background-color: red;
font-size: 40px;
} (a) on the right (b) in the middle (c) on the left -
4.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 768px) {
p {
font-size: 6px;
}
} -
5.🎯 Which CSS selector matches this element?
<span class="menu" id="logo">Hello</span> (a) #logo (b) .note (c) p (d) .logo - 6.🎨 What does CSS stand for? (a) Cascading Style Sheets (b) Colourful Site Styles (c) Creative Sheet System (d) Computer Style Sheets
- 7.🌈 Which hex code is black? (a) #000000 (b) #00ffff (c) #ff0000 (d) #ffff00
- 8.📱 Which tag helps phones show a page at the right size? (a) the viewport meta tag (b) the hr tag (c) the br tag (d) the title tag
- 9.⚖️ Which selector is the weakest? (a) a class selector (b) an id selector (c) an element selector
-
10.⚖️ What colour is the text of this element?
<p class="star" id="hero">Hi</p>
CSS:
.star { color: blue; }
#hero { color: orange; } (a) blue (b) black (c) green (d) orange - 11.✍️ In color: blue; which part is the property? (a) color (b) ; (c) : (d) blue
-
12.✍️ What is the selector in this CSS rule?
li {
font-size: 20px;
font-weight: bold;
} (a) body (b) li (c) bold (d) font-size - 13.🧩 Which language reacts to a button click? (a) CSS (b) JavaScript (c) HTML
- 14.🌈 Which colour is rgb(255, 0, 0)? (a) yellow (b) black (c) bright green (d) red
- 15.What does justify-content: space-between 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
- 16.🌈 Which colour is rgb(0, 0, 255)? (a) red (b) cyan (c) blue (d) magenta
-
17.📱 The screen is 700px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (min-width: 1024px) {
p {
font-size: 24px;
}
} (a) No (b) Yes -
18.🖌️ Where does the text sit on its line?
li {
background-color: green;
color: yellow;
font-size: 32px;
text-align: right;
} (a) on the right (b) in the middle (c) on the left - 19.🌈 In #rrggbb, which colour do the first two digits give? (a) black (b) green (c) blue (d) red
-
20.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (max-width: 600px) {
p {
font-size: 20px;
}
} - 21.💪 Which justify-content value equal gaps, none at ends? (a) center (b) flex-start (c) flex-end (d) space-between
- 22.🌈 Which colour of light is strongest in rgb(137, 205, 123)? (a) green (b) blue (c) red
-
23.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 768px) {
p {
font-size: 10px;
}
} - 24.💪 Which flexbox property sets space between boxes? (a) gap (b) align-items (c) display: flex (d) flex-direction
- 25.📦 In the box model, which part is space inside the border? (a) border (b) content (c) margin (d) padding
-
26.🎯 Which CSS selector matches this element?
<h2 class="menu" id="logo">Hello</h2> (a) li (b) h2 (c) #menu (d) .note - 27.🎨 A CSS file usually ends with which extension? (a) .png (b) .css (c) .js (d) .html
-
28.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (max-width: 768px) {
p {
font-size: 20px;
}
} - 29.📱 Responsive design means a page ___. (a) fits every screen (b) never changes (c) has no pictures (d) is only for laptops
- 30.True or false: img is an element selector. (a) True (b) False
-
31.✍️ How many declarations (property: value pairs) are in this rule?
h1 {
margin: 10px;
border: 2px solid;
padding: 8px;
} -
32.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 110px;
justify-content: flex-start;
}
Inside are 2 boxes, each 50px wide (no margins). - 33.What does background-color do? (a) sets the letter colour (b) makes the text bold (c) picks the font style (d) colours behind the text
-
34.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 180px;
justify-content: flex-end;
}
Inside are 2 boxes, each 80px wide (no margins). - 35.🌈 Hex digits go 0 to 9, then A to which letter? (a) J (b) Z (c) G (d) F
- 36.Which of these is margin? (a) a solid or dotted edge (b) the text or picture (c) space inside the border (d) space outside the border
- 37.🌈 Which colour is #ff0000? (a) red (b) cyan (c) blue (d) black
-
38.🎯 Which CSS selector matches this element?
<div class="red" id="intro">Hello</div> (a) span (b) div (c) #main (d) .box -
39.⚖️ What colour is the text of this element?
<h1 class="note" id="hero">Hi</h1>
CSS:
h1 { color: yellow; }
.note { color: black; } (a) red (b) white (c) black (d) yellow - 40.🌈 Which colour is rgb(0, 255, 255)? (a) white (b) magenta (c) yellow (d) cyan
Answer key
- an id selector
- Yes
- on the right
- 6
- #logo
- Cascading Style Sheets
- #000000
- the viewport meta tag
- an element selector
- orange
- color
- li
- JavaScript
- red
- equal gaps, none at ends
- blue
- No
- on the right
- red
- 24
- space-between
- green
- 12
- gap
- padding
- h2
- .css
- 24
- fits every screen
- True
- 3
- 10
- colours behind the text
- 20
- F
- space outside the border
- red
- div
- black
- cyan
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids