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 justify-content: space-between do? (a) puts boxes in the middle (b) packs boxes at the start (c) equal gaps, none at ends (d) packs boxes at the end
-
2.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 600px) {
p {
font-size: 26px;
}
} - 3.Which of these does HTML do? (a) changes the page live (b) changes the text size (c) checks a quiz answer (d) makes a form box
-
4.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 600px) {
p {
font-size: 30px;
}
} -
5.✍️ What is the selector in this CSS rule?
p {
color: red;
text-align: center;
font-style: italic;
} (a) .note (b) center (c) p (d) color - 6.✍️ In color: blue; which part is the value? (a) blue (b) color (c) ; (d) :
- 7.🔍 Which is the odd one out? (a) checks a quiz answer (b) gives the page structure (c) changes the page live (d) counts down a timer
- 8.💪 Which justify-content value packs boxes at the start? (a) center (b) flex-end (c) flex-start (d) space-between
-
9.🖌️ How big is the text, in px?
h1 {
font-size: 20px;
text-align: center;
color: white;
background-color: yellow;
} -
10.🖌️ What colour are the letters?
h1 {
text-align: left;
font-size: 20px;
color: yellow;
background-color: black;
} (a) yellow (b) black (c) white - 11.True or false: JavaScript counts down a timer. (a) False (b) True
- 12.🌈 Which colour of light is strongest in rgb(224, 107, 118)? (a) red (b) blue (c) green
-
13.✍️ How many declarations (property: value pairs) are in this rule?
#top {
text-align: center;
border: 2px solid;
color: red;
} - 14.Which of these does CSS do? (a) adds space around boxes (b) changes the page live (c) makes a form box (d) puts a picture on a page
- 15.⚖️ Which selector is the weakest? (a) a class selector (b) an id selector (c) an element selector
- 16.🖌️ Which CSS property centres a heading? (a) text-align (b) font-family (c) font-weight (d) font-size
- 17.🔍 Which is the odd one out? (a) changes the text size (b) lays out the page (c) sets colours and fonts (d) puts a picture on a page
- 18.🧩 Which language changes the page live? (a) HTML (b) CSS (c) JavaScript
- 19.True or false: #logo is an id selector. (a) False (b) True
-
20.🎯 Which CSS selector matches this element?
<li class="menu" id="hero">Hello</li> (a) div (b) #menu (c) #hero (d) .note - 21.🌈 Which colour is #ff0000? (a) black (b) yellow (c) red (d) bright green
- 22.🌈 Hex digits go 0 to 9, then A to which letter? (a) Z (b) G (c) F (d) J
- 23.True or false: HTML makes headings and lists. (a) False (b) True
-
24.✍️ What is the selector in this CSS rule?
p {
font-size: 20px;
color: red;
font-style: italic;
border: 2px solid;
} (a) red (b) .note (c) font-size (d) p -
25.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 40px;
padding: 25px;
border: 5px solid black;
margin: 20px;
} - 26.⚖️ Which selector is the strongest? (a) an element selector (b) a class selector (c) an id selector
- 27.📦 In the box model, which part is the gap to other boxes? (a) border (b) margin (c) padding (d) content
- 28.🧩 Which language shows a pop-up message? (a) CSS (b) HTML (c) JavaScript
- 29.🌈 Which colour is rgb(0, 255, 0)? (a) bright green (b) cyan (c) yellow (d) black
-
30.✍️ What is the selector in this CSS rule?
p {
color: red;
margin: 10px;
} (a) 10px (b) color (c) .note (d) p -
31.✍️ Which property is set to 10px in this rule?
#top {
margin: 10px;
font-weight: bold;
} (a) margin (b) font-weight (c) 10px (d) padding -
32.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 320px;
justify-content: space-between;
}
Inside are 3 boxes, each 100px wide (no margins). -
33.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 130px;
justify-content: space-between;
}
Inside are 2 boxes, each 40px wide (no margins). -
34.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 600px) {
p {
font-size: 32px;
}
} -
35.📱 The screen is 414px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 1024px) {
p {
font-size: 14px;
}
} (a) No (b) Yes -
36.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (max-width: 1024px) {
p {
font-size: 18px;
}
} -
37.⚖️ What colour is the text of this element?
<h2 class="note" id="main">Hi</h2>
CSS:
#main { color: blue; }
h2 { color: orange; } (a) white (b) orange (c) blue (d) red - 38.💪 Which flexbox property turns on flexbox? (a) display: flex (b) gap (c) flex-direction (d) justify-content
-
39.✍️ How many declarations (property: value pairs) are in this rule?
h2 {
font-weight: bold;
color: red;
} - 40.🎯 Which element does the selector div style? (a) <span> (b) <h1 id="top"> (c) <div class="note"> (d) <p class="note">
Answer key
- equal gaps, none at ends
- 26
- makes a form box
- 24
- p
- blue
- gives the page structure
- flex-start
- 20
- yellow
- True
- red
- 3
- adds space around boxes
- an element selector
- text-align
- puts a picture on a page
- JavaScript
- True
- #hero
- red
- F
- True
- p
- 140
- an id selector
- margin
- JavaScript
- bright green
- p
- margin
- 10
- 50
- 24
- Yes
- 18
- blue
- display: flex
- 2
- <div class="note">
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids