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.What does font-size do? (a) makes the text bold (b) colours behind the text (c) sets the letter colour (d) makes letters bigger
- 2.🧩 Which language puts a picture on a page? (a) CSS (b) JavaScript (c) HTML
-
3.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (min-width: 1024px) {
p {
font-size: 16px;
}
} (a) Yes (b) No -
4.🖌️ What colour are the letters?
h2 {
text-align: left;
background-color: purple;
color: blue;
font-size: 40px;
} (a) black (b) purple (c) blue - 5.True or false: CSS sets colours and fonts. (a) False (b) True
- 6.🎯 Which element does the selector .note style? (a) <h1 class="big"> (b) <h1 id="note"> (c) <h1 class="note"> (d) <h2 class="red">
- 7.🌈 Which hex code is cyan? (a) #000000 (b) #0000ff (c) #00ffff (d) #ff00ff
-
8.✍️ How many declarations (property: value pairs) are in this rule?
body {
font-style: italic;
} - 9.🎯 How many elements on a page should have the same id? (a) 1 (b) 5 (c) 2 (d) any number
-
10.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (max-width: 600px) {
p {
font-size: 22px;
}
} - 11.🎨 Which tag connects an outside CSS file? (a) <img> (b) <a> (c) <css> (d) <link>
- 12.💪 Which flexbox property picks row or column? (a) flex-direction (b) gap (c) align-items (d) display: flex
- 13.🎯 Which element does the selector h1 style? (a) <li class="menu"> (b) <h1 class="menu"> (c) <h2> (d) <div id="intro">
-
14.🖌️ What colour is behind the letters?
li {
text-align: left;
background-color: red;
color: white;
font-size: 20px;
} (a) red (b) white (c) yellow -
15.⚖️ What colour is the text of this element?
<h2 class="big" id="intro">Hi</h2>
CSS:
#intro { color: blue; }
h2 { color: green; } (a) purple (b) green (c) blue (d) black - 16.🎯 Which sign starts a class selector? (a) & (b) # (c) @ (d) .
-
17.🖌️ What colour is behind the letters?
li {
font-size: 24px;
text-align: left;
background-color: blue;
color: yellow;
} (a) blue (b) yellow (c) purple - 18.📱 Which tag helps phones show a page at the right size? (a) the br tag (b) the title tag (c) the hr tag (d) the viewport meta tag
-
19.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 240px;
justify-content: center;
}
Inside are 2 boxes, each 50px wide (no margins). - 20.🎯 What kind of selector is h1? (a) a class selector (b) an element selector (c) an id selector
-
21.✍️ What is the selector in this CSS rule?
h2 {
border: 2px solid;
color: red;
padding: 8px;
font-size: 20px;
} (a) border (b) h2 (c) h1 (d) red - 22.🌈 What is the biggest number one colour can have in rgb()? (a) 255 (b) 100 (c) 1000 (d) 99
- 23.True or false: padding is the text or picture. (a) False (b) True
- 24.🌈 Which hex code is bright green? (a) #00ff00 (b) #ffff00 (c) #ff0000 (d) #000000
-
25.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (min-width: 600px) {
p {
font-size: 18px;
}
} -
26.⚖️ What colour is the text of this element?
<h1 class="note" id="intro">Hi</h1>
CSS:
.note { color: purple; }
h1 { color: black; }
#intro { color: blue; } (a) purple (b) black (c) orange (d) blue - 27.True or false: margin is space outside the border. (a) False (b) True
- 28.🎯 Which element does the selector .box style? (a) <span class="box"> (b) <span class="star"> (c) <p class="menu"> (d) <span id="box">
- 29.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
- 30.True or false: .star is an element selector. (a) False (b) True
- 31.🌈 In #fc0000 the red part is the hex number fc. What is it as a normal number?
-
32.✍️ What is the selector in this CSS rule?
p {
font-weight: bold;
text-align: center;
padding: 8px;
color: red;
} (a) p (b) font-weight (c) .note (d) center -
33.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 320px;
justify-content: flex-end;
}
Inside are 4 boxes, each 60px wide (no margins). -
34.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 460px;
justify-content: center;
}
Inside are 3 boxes, each 100px wide (no margins). - 35.💪 Which flexbox property turns on flexbox? (a) display: flex (b) gap (c) align-items (d) justify-content
-
36.📱 The screen is 1100px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (min-width: 768px) {
p {
font-size: 18px;
}
} (a) Yes (b) No - 37.True or false: #hero is an element selector. (a) False (b) True
-
38.📱 The screen is 540px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 480px) {
p {
font-size: 12px;
}
} (a) No (b) Yes -
39.🖌️ Where does the text sit on its line?
h1 {
text-align: right;
background-color: yellow;
color: black;
font-size: 32px;
} (a) on the right (b) on the left (c) in the middle - 40.📦 In the box model, which part is a solid or dotted edge? (a) margin (b) padding (c) border (d) content
Answer key
- makes letters bigger
- HTML
- No
- blue
- True
- <h1 class="note">
- #00ffff
- 1
- 1
- 24
- <link>
- flex-direction
- <h1 class="menu">
- red
- blue
- .
- blue
- the viewport meta tag
- 70
- an element selector
- h2
- 255
- False
- #00ff00
- 18
- blue
- True
- <span class="box">
- equal gaps, none at ends
- False
- 252
- p
- 80
- 80
- display: flex
- Yes
- False
- No
- on the right
- border
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids