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 is the odd one out? (a) puts a picture on a page (b) makes headings and lists (c) makes a link (d) counts down a timer
-
2.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 180px;
justify-content: flex-end;
}
Inside are 2 boxes, each 50px wide (no margins). -
3.✍️ Which property is set to 8px in this rule?
li {
margin: 10px;
padding: 8px;
} (a) font-weight (b) border (c) 8px (d) padding - 4.What does font-family do? (a) makes the text bold (b) makes letters bigger (c) colours behind the text (d) picks the font style
- 5.🌈 What is the biggest number one colour can have in rgb()? (a) 1000 (b) 99 (c) 100 (d) 255
- 6.🌈 Which colour is rgb(255, 0, 0)? (a) magenta (b) white (c) red (d) bright green
- 7.⚖️ Which selector is the weakest? (a) an id selector (b) a class selector (c) an element selector
-
8.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 320px;
justify-content: space-between;
}
Inside are 4 boxes, each 50px wide (no margins). - 9.✍️ Which sign goes between a property and its value? (a) - (b) = (c) ; (d) :
- 10.What does font-size do? (a) picks the font style (b) colours behind the text (c) sets the letter colour (d) makes letters bigger
- 11.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the later one (b) the shorter one (c) the first one (d) neither
- 12.True or false: li is an element selector. (a) True (b) False
-
13.🖌️ What colour are the letters?
p {
text-align: left;
font-size: 16px;
background-color: green;
color: blue;
} (a) blue (b) green (c) black -
14.⚖️ What colour is the text of this element?
<h2 class="red" id="top">Hi</h2>
CSS:
#top { color: blue; }
.red { color: purple; }
h2 { color: green; } (a) blue (b) purple (c) red (d) green -
15.🎯 Which CSS selector matches this element?
<h1 class="star" id="hero">Hello</h1> (a) .hero (b) #top (c) #star (d) .star - 16.🧩 Which language makes a link? (a) CSS (b) HTML (c) JavaScript
- 17.💪 Which flexbox property picks row or column? (a) justify-content (b) flex-direction (c) display: flex (d) align-items
-
18.✍️ What is the selector in this CSS rule?
.note {
font-size: 20px;
padding: 8px;
text-align: center;
font-style: italic;
} (a) .note (b) 8px (c) #top (d) font-size -
19.✍️ Which property is set to center in this rule?
h1 {
padding: 8px;
text-align: center;
} (a) background-color (b) text-align (c) margin (d) center -
20.✍️ Which property is set to center in this rule?
p {
color: red;
text-align: center;
font-size: 20px;
} (a) center (b) text-align (c) background-color (d) margin - 21.✍️ In color: blue; which part is the value? (a) blue (b) : (c) ; (d) color
- 22.🔍 Which is the odd one out? (a) lays out the page (b) sets colours and fonts (c) adds space around boxes (d) gives the page structure
-
23.✍️ What value is given to background-color in this rule?
li {
color: red;
background-color: yellow;
} (a) yellow (b) background-color (c) 8px (d) 10px -
24.⚖️ What colour is the text of this element?
<h2 class="star" id="hero">Hi</h2>
CSS:
#hero { color: red; }
h2 { color: orange; } (a) orange (b) red (c) yellow (d) blue - 25.🧩 Which language counts down a timer? (a) CSS (b) HTML (c) JavaScript
- 26.True or false: .note is a class selector. (a) False (b) True
-
27.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 600px) {
p {
font-size: 18px;
}
} -
28.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 768px) {
p {
font-size: 14px;
}
} -
29.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (max-width: 480px) {
p {
font-size: 18px;
}
} -
30.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 210px;
padding: 25px;
border: 3px solid black;
margin: 0px;
} - 31.🎯 What kind of selector is #logo? (a) an element selector (b) an id selector (c) a class selector
-
32.🖌️ What colour is behind the letters?
h1 {
background-color: black;
text-align: center;
font-size: 20px;
color: orange;
} (a) orange (b) white (c) black - 33.True or false: HTML makes headings and lists. (a) False (b) True
- 34.🎯 What kind of selector is .note? (a) an element selector (b) a class selector (c) an id selector
- 35.True or false: .star is an element selector. (a) True (b) False
- 36.🎯 Can many elements share the same class? (a) Yes (b) No
-
37.✍️ What is the selector in this CSS rule?
.box {
font-size: 20px;
border: 2px solid;
margin: 10px;
font-style: italic;
} (a) font-size (b) h2 (c) .box (d) 2px solid - 38.⚖️ Which selector is the strongest? (a) a class selector (b) an id selector (c) an element selector
- 39.🎯 Which sign starts an id selector? (a) . (b) @ (c) # (d) &
- 40.True or false: the content is the text or picture. (a) True (b) False
Answer key
- counts down a timer
- 80
- padding
- picks the font style
- 255
- red
- an element selector
- 40
- :
- makes letters bigger
- the later one
- True
- blue
- blue
- .star
- HTML
- flex-direction
- .note
- text-align
- text-align
- blue
- gives the page structure
- yellow
- red
- JavaScript
- True
- 18
- 14
- 18
- 266
- an id selector
- black
- True
- a class selector
- False
- Yes
- .box
- an id selector
- #
- True
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids