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 colour is rgb(0, 0, 255)? (a) blue (b) white (c) yellow (d) red
-
2.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 480px) {
p {
font-size: 30px;
}
} -
3.✍️ Which property is set to 8px in this rule?
body {
padding: 8px;
text-align: center;
} (a) padding (b) font-weight (c) 8px (d) border - 4.🎯 What kind of selector is #top? (a) an id selector (b) an element selector (c) a class selector
-
5.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 90px;
padding: 20px;
border: 2px solid black;
margin: 15px;
} - 6.🌈 Which hex code is white? (a) #ff00ff (b) #ff0000 (c) #000000 (d) #ffffff
- 7.🎯 Which element does the selector li style? (a) <li class="big"> (b) <div> (c) <p id="end"> (d) <span class="big">
- 8.🎨 Which attribute adds CSS inside one tag? (a) alt (b) href (c) src (d) style
-
9.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 1024px) {
p {
font-size: 14px;
}
} - 10.🌈 Which colour is #ffffff? (a) bright green (b) white (c) red (d) magenta
- 11.🌈 Which colour of light is strongest in rgb(87, 152, 117)? (a) green (b) blue (c) red
- 12.🎨 One CSS file can style how many pages? (a) only one image (b) only one word (c) no pages (d) many pages
- 13.🧩 Which language lays out the page? (a) HTML (b) JavaScript (c) CSS
- 14.💪 Which justify-content value equal gaps, none at ends? (a) flex-start (b) center (c) flex-end (d) space-between
- 15.💪 Which justify-content value puts boxes in the middle? (a) center (b) space-between (c) flex-start (d) flex-end
- 16.True or false: CSS reacts to a button click. (a) False (b) True
- 17.🖌️ Which CSS property colours behind the text? (a) font-weight (b) font-family (c) background-color (d) font-size
-
18.✍️ How many declarations (property: value pairs) are in this rule?
.note {
border: 2px solid;
} -
19.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (min-width: 480px) {
p {
font-size: 28px;
}
} - 20.Which of these does JavaScript do? (a) shows a pop-up message (b) sets colours and fonts (c) changes the text size (d) gives the page structure
-
21.✍️ How many declarations (property: value pairs) are in this rule?
#top {
padding: 8px;
margin: 10px;
} - 22.🌈 What is the biggest number one colour can have in rgb()? (a) 99 (b) 1000 (c) 255 (d) 100
-
23.⚖️ What colour is the text of this element?
<p class="box" id="end">Hi</p>
CSS:
p { color: yellow; }
p { color: blue; } (a) yellow (b) red (c) blue (d) black -
24.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 200px;
justify-content: space-between;
}
Inside are 2 boxes, each 60px wide (no margins). - 25.🎯 What kind of selector is .card? (a) an id selector (b) a class selector (c) an element selector
- 26.⚖️ Which selector is the weakest? (a) an id selector (b) an element selector (c) a class selector
-
27.✍️ What is the selector in this CSS rule?
li {
width: 300px;
border: 2px solid;
margin: 10px;
} (a) width (b) body (c) 2px solid (d) li - 28.✍️ Which sign goes between a property and its value? (a) - (b) ; (c) = (d) :
-
29.📱 The screen is 700px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 768px) {
p {
font-size: 8px;
}
} (a) Yes (b) No -
30.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 290px;
justify-content: flex-start;
}
Inside are 4 boxes, each 60px wide (no margins). -
31.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 1024px) {
p {
font-size: 10px;
}
} -
32.⚖️ What colour is the text of this element?
<p class="menu" id="top">Hi</p>
CSS:
#top { color: black; }
p { color: white; } (a) blue (b) red (c) black (d) white -
33.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 190px;
padding: 25px;
border: 2px solid black;
margin: 20px;
} - 34.Which of these is margin? (a) the gap round content (b) space outside the border (c) the text or picture (d) the line round the box
-
35.✍️ Which property is set to bold in this rule?
body {
font-weight: bold;
color: red;
font-style: italic;
text-align: center;
} (a) border (b) bold (c) font-weight (d) width - 36.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the first one (b) the shorter one (c) the later one (d) neither
- 37.📦 In the box model, which part is the line round the box? (a) padding (b) content (c) margin (d) border
- 38.True or false: the content is the text or picture. (a) True (b) False
- 39.What does justify-content: flex-end do? (a) packs boxes at the start (b) puts boxes in the middle (c) packs boxes at the end (d) equal gaps, none at ends
- 40.💪 Which flexbox property picks row or column? (a) justify-content (b) flex-direction (c) gap (d) align-items
Answer key
- blue
- 24
- padding
- an id selector
- 164
- #ffffff
- <li class="big">
- style
- 14
- white
- green
- many pages
- CSS
- space-between
- center
- False
- background-color
- 1
- 20
- shows a pop-up message
- 2
- 255
- blue
- 80
- a class selector
- an element selector
- li
- :
- Yes
- 50
- 10
- black
- 284
- space outside the border
- font-weight
- the later one
- border
- True
- packs boxes at the end
- flex-direction
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids