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.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 600px) {
p {
font-size: 14px;
}
} - 2.💪 Which flexbox property lines boxes up across? (a) display: flex (b) gap (c) justify-content (d) align-items
- 3.🧩 Which language changes the page live? (a) HTML (b) JavaScript (c) CSS
- 4.True or false: the border is the line round the box. (a) True (b) False
- 5.📱 min-width: 800px applies when the screen is ___. (a) 800px or wider (b) exactly 100px (c) 800px or narrower (d) turned off
- 6.True or false: JavaScript counts down a timer. (a) False (b) True
- 7.💪 Which justify-content value packs boxes at the end? (a) flex-end (b) flex-start (c) space-between (d) center
- 8.🌈 Which colour is #ffff00? (a) black (b) white (c) magenta (d) yellow
- 9.Which of these does HTML do? (a) puts a picture on a page (b) adds space around boxes (c) changes the text size (d) reacts to a button click
- 10.True or false: CSS changes the page live. (a) False (b) True
-
11.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 160px;
padding: 10px;
border: 4px solid black;
margin: 20px;
} -
12.✍️ What is the selector in this CSS rule?
li {
font-weight: bold;
padding: 8px;
width: 300px;
} (a) body (b) 8px (c) font-weight (d) li - 13.🖌️ Which CSS property centres a heading? (a) text-align (b) font-weight (c) font-size (d) color
-
14.⚖️ What colour is the text of this element?
<h1 class="menu" id="logo">Hi</h1>
CSS:
h1 { color: black; }
#logo { color: red; }
.menu { color: orange; } (a) black (b) red (c) orange (d) green - 15.True or false: li is a class selector. (a) False (b) True
-
16.✍️ What is the selector in this CSS rule?
body {
color: red;
padding: 8px;
margin: 10px;
} (a) 8px (b) color (c) body (d) .box -
17.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 200px;
justify-content: flex-start;
}
Inside are 3 boxes, each 40px wide (no margins). - 18.True or false: padding is a solid or dotted edge. (a) True (b) False
- 19.🎯 What kind of selector is h1? (a) an id selector (b) a class selector (c) an element selector
- 20.🌈 In #rrggbb, which colour do the first two digits give? (a) red (b) green (c) blue (d) black
- 21.Which of these does JavaScript do? (a) rounds box corners (b) checks a quiz answer (c) makes headings and lists (d) adds space around boxes
-
22.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 768px) {
p {
font-size: 10px;
}
} (a) Yes (b) No -
23.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 480px) {
p {
font-size: 12px;
}
} -
24.✍️ How many declarations (property: value pairs) are in this rule?
h1 {
font-weight: bold;
color: red;
width: 300px;
} - 25.🎯 Which element does the selector .red style? (a) <li class="box"> (b) <li id="red"> (c) <li class="red"> (d) <div class="star">
- 26.📱 max-width: 600px applies when the screen is ___. (a) 600px or narrower (b) 600px or wider (c) turned off (d) exactly 1000px
-
27.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 180px;
justify-content: flex-end;
}
Inside are 3 boxes, each 40px wide (no margins). - 28.🌈 Which colour of light is strongest in rgb(255, 118, 15)? (a) green (b) red (c) blue
-
29.🖌️ What colour is behind the letters?
li {
color: orange;
background-color: yellow;
text-align: right;
font-size: 16px;
} (a) orange (b) yellow (c) red -
30.🎯 Which CSS selector matches this element?
<h1 class="big" id="logo">Hello</h1> (a) #big (b) .logo (c) h2 (d) h1 -
31.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 420px;
justify-content: flex-start;
}
Inside are 4 boxes, each 100px wide (no margins). - 32.🎯 Which element does the selector div style? (a) <span> (b) <p class="red"> (c) <h1 id="end"> (d) <div class="red">
-
33.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 220px;
justify-content: center;
}
Inside are 2 boxes, each 100px wide (no margins). -
34.📱 The screen is 820px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (max-width: 1024px) {
p {
font-size: 22px;
}
} (a) No (b) Yes - 35.🌈 In #8a0000 the red part is the hex number 8a. What is it as a normal number?
- 36.🧩 Which language shows a pop-up message? (a) HTML (b) CSS (c) JavaScript
- 37.🎯 Which element does the selector .star style? (a) <h1 class="star"> (b) <h1 class="menu"> (c) <h2 class="note"> (d) <h1 id="star">
- 38.🖌️ Which CSS property sets the letter colour? (a) font-size (b) text-align (c) color (d) font-family
- 39.Which of these does HTML do? (a) counts down a timer (b) sets colours and fonts (c) makes headings and lists (d) changes the text size
- 40.True or false: .big is a class selector. (a) False (b) True
Answer key
- 14
- align-items
- JavaScript
- True
- 800px or wider
- True
- flex-end
- yellow
- puts a picture on a page
- False
- 228
- li
- text-align
- red
- False
- body
- 80
- False
- an element selector
- red
- checks a quiz answer
- Yes
- 16
- 3
- <li class="red">
- 600px or narrower
- 60
- red
- yellow
- h1
- 20
- <div class="red">
- 10
- Yes
- 138
- JavaScript
- <h1 class="star">
- color
- makes headings and lists
- True
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids