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 CSS property colours behind the text? (a) color (b) font-weight (c) font-size (d) background-color
- 2.🌈 Which colour of light is strongest in rgb(77, 125, 175)? (a) red (b) green (c) blue
- 3.💪 Which flexbox property lines boxes up across? (a) display: flex (b) align-items (c) justify-content (d) flex-direction
- 4.What does font-family do? (a) sets the letter colour (b) makes the text bold (c) picks the font style (d) centres a heading
- 5.🎯 How many elements on a page should have the same id? (a) any number (b) 1 (c) 2 (d) 5
- 6.💪 Which flexbox property spaces boxes along a row? (a) flex-direction (b) justify-content (c) display: flex (d) gap
- 7.🖌️ Which CSS property centres a heading? (a) color (b) background-color (c) font-size (d) text-align
-
8.✍️ Which property is set to 300px in this rule?
p {
width: 300px;
margin: 10px;
} (a) width (b) 300px (c) font-style (d) color - 9.🌈 Which colour of light is strongest in rgb(52, 107, 247)? (a) red (b) blue (c) green
-
10.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 480px) {
p {
font-size: 10px;
}
} -
11.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 230px;
justify-content: flex-start;
}
Inside are 2 boxes, each 100px wide (no margins). -
12.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 80px;
padding: 10px;
border: 4px solid black;
margin: 10px;
} - 13.✍️ How does a CSS comment start? (a) /* (b) <!-- (c) // (d) #
-
14.🎯 Which CSS selector matches this element?
<h2 class="box" id="top">Hello</h2> (a) .star (b) #box (c) .box (d) #intro - 15.🔍 Which is the odd one out? (a) shows a pop-up message (b) makes a link (c) reacts to a button click (d) counts down a timer
-
16.✍️ Which property is set to 10px in this rule?
#top {
width: 300px;
font-weight: bold;
margin: 10px;
} (a) margin (b) font-weight (c) padding (d) 10px -
17.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 480px) {
p {
font-size: 10px;
}
} -
18.🎯 Which CSS selector matches this element?
<p class="star" id="top">Hello</p> (a) #star (b) .menu (c) .star (d) h1 -
19.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 390px;
justify-content: flex-start;
}
Inside are 4 boxes, each 80px wide (no margins). - 20.🖌️ Which CSS property makes letters bigger? (a) color (b) font-size (c) background-color (d) text-align
-
21.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 270px;
justify-content: space-between;
}
Inside are 4 boxes, each 60px wide (no margins). - 22.📦 In the box model, which part is the gap round content? (a) padding (b) margin (c) content (d) border
- 23.📦 In the box model, which part is the line round the box? (a) content (b) border (c) margin (d) padding
- 24.True or false: img is a class selector. (a) True (b) False
- 25.📦 In the box model, which part is a solid or dotted edge? (a) margin (b) border (c) padding (d) content
- 26.🎯 What kind of selector is .card? (a) an id selector (b) an element selector (c) a class selector
- 27.🔍 Which is the odd one out? (a) makes a form box (b) gives the page structure (c) lays out the page (d) makes headings and lists
-
28.✍️ Which property is set to yellow in this rule?
h1 {
background-color: yellow;
font-size: 20px;
} (a) margin (b) yellow (c) padding (d) background-color -
29.✍️ How many declarations (property: value pairs) are in this rule?
body {
font-size: 20px;
} - 30.🎯 Which element does the selector span style? (a) <h1 class="box"> (b) <h2 id="hero"> (c) <p> (d) <span class="box">
- 31.🌈 Which colour of light is strongest in rgb(75, 170, 126)? (a) blue (b) green (c) red
- 32.🎯 Which sign starts a class selector? (a) # (b) @ (c) . (d) &
- 33.🧩 Which language counts down a timer? (a) CSS (b) JavaScript (c) HTML
-
34.⚖️ What colour is the text of this element?
<p class="menu" id="intro">Hi</p>
CSS:
#intro { color: blue; }
#intro { color: purple; } (a) green (b) white (c) blue (d) purple -
35.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 210px;
justify-content: flex-start;
}
Inside are 4 boxes, each 50px wide (no margins). - 36.🌈 Which hex code is cyan? (a) #000000 (b) #00ffff (c) #ffff00 (d) #ff00ff
- 37.🧩 Which language changes the text size? (a) JavaScript (b) CSS (c) HTML
- 38.🎯 What kind of selector is h1? (a) an id selector (b) a class selector (c) an element selector
- 39.🖌️ Which CSS property sets the letter colour? (a) font-weight (b) text-align (c) color (d) font-size
-
40.✍️ What value is given to text-align in this rule?
h2 {
text-align: center;
color: red;
font-weight: bold;
} (a) yellow (b) center (c) text-align (d) 10px
Answer key
- background-color
- blue
- align-items
- picks the font style
- 1
- justify-content
- text-align
- width
- blue
- 12
- 30
- 128
- /*
- .box
- makes a link
- margin
- 10
- .star
- 70
- font-size
- 10
- padding
- border
- False
- border
- a class selector
- lays out the page
- background-color
- 1
- <span class="box">
- green
- .
- JavaScript
- purple
- 10
- #00ffff
- CSS
- an element selector
- color
- center
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids