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) colours behind the text (b) makes letters bigger (c) picks the font style (d) makes the text bold
- 2.What does justify-content: flex-end do? (a) equal gaps, none at ends (b) packs boxes at the start (c) packs boxes at the end (d) puts boxes in the middle
- 3.🧩 Which language lays out the page? (a) CSS (b) HTML (c) JavaScript
-
4.⚖️ What colour is the text of this element?
<h2 class="star" id="main">Hi</h2>
CSS:
#main { color: yellow; }
.star { color: black; } (a) black (b) purple (c) blue (d) yellow -
5.⚖️ What colour is the text of this element?
<p class="note" id="logo">Hi</p>
CSS:
.note { color: orange; }
#logo { color: red; }
p { color: blue; } (a) blue (b) red (c) yellow (d) orange - 6.Which of these does JavaScript do? (a) counts down a timer (b) changes the text size (c) gives the page structure (d) makes a link
- 7.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the first one (b) neither (c) the shorter one (d) the later one
-
8.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 270px;
justify-content: flex-start;
}
Inside are 4 boxes, each 60px wide (no margins). - 9.🌈 Which colour of light is strongest in rgb(179, 28, 63)? (a) green (b) blue (c) red
- 10.🧩 Which language changes the page live? (a) CSS (b) JavaScript (c) HTML
- 11.📱 What does a media query check? (a) the time of day (b) the battery level (c) the screen width (d) the page title
-
12.✍️ What is the selector in this CSS rule?
p {
color: red;
background-color: yellow;
border: 2px solid;
} (a) color (b) .note (c) p (d) yellow -
13.🖌️ What colour are the letters?
li {
text-align: left;
font-size: 32px;
color: white;
background-color: yellow;
} (a) yellow (b) white (c) red - 14.🎯 Which sign starts an id selector? (a) @ (b) # (c) & (d) .
- 15.True or false: CSS lays out the page. (a) False (b) True
- 16.📱 min-width: 800px applies when the screen is ___. (a) turned off (b) exactly 100px (c) 800px or wider (d) 800px or narrower
- 17.⚖️ Which selector is the strongest? (a) a class selector (b) an element selector (c) an id selector
-
18.⚖️ What colour is the text of this element?
<p class="note" id="hero">Hi</p>
CSS:
#hero { color: yellow; }
.note { color: purple; }
p { color: orange; } (a) yellow (b) blue (c) purple (d) orange -
19.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 140px;
padding: 15px;
border: 2px solid black;
margin: 15px;
} -
20.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 160px;
justify-content: flex-start;
}
Inside are 2 boxes, each 50px wide (no margins). - 21.💪 Which justify-content value puts boxes in the middle? (a) flex-start (b) flex-end (c) center (d) space-between
- 22.💪 Which justify-content value equal gaps, none at ends? (a) flex-end (b) space-between (c) center (d) flex-start
- 23.🌈 Which colour is rgb(255, 0, 255)? (a) yellow (b) black (c) white (d) magenta
- 24.🌈 Which colour of light is strongest in rgb(15, 107, 230)? (a) blue (b) green (c) red
- 25.🎨 One CSS file can style how many pages? (a) no pages (b) only one word (c) only one image (d) many pages
-
26.📱 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;
}
} - 27.Which of these is padding? (a) the gap round content (b) the gap to other boxes (c) the text or picture (d) the line round the box
- 28.🌈 Which colour is #00ffff? (a) magenta (b) blue (c) black (d) cyan
- 29.🎨 Which tag connects an outside CSS file? (a) <a> (b) <img> (c) <css> (d) <link>
- 30.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 3 (b) 2 (c) 4 (d) 6
- 31.🌈 Which colour is rgb(255, 255, 0)? (a) magenta (b) yellow (c) bright green (d) black
-
32.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 150px;
justify-content: flex-start;
}
Inside are 2 boxes, each 40px wide (no margins). - 33.🖌️ Which CSS property picks the font style? (a) font-weight (b) font-family (c) color (d) font-size
- 34.🎯 Can many elements share the same class? (a) No (b) Yes
- 35.🌈 Which colour of light is strongest in rgb(154, 100, 31)? (a) red (b) blue (c) green
-
36.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 70px;
padding: 15px;
border: 4px solid black;
margin: 5px;
} - 37.🌈 Which hex code is white? (a) #00ff00 (b) #ff0000 (c) #00ffff (d) #ffffff
-
38.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 140px;
justify-content: flex-end;
}
Inside are 2 boxes, each 60px wide (no margins). -
39.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (max-width: 480px) {
p {
font-size: 22px;
}
} - 40.🎯 Which element does the selector #hero style? (a) <p id="top"> (b) <p class="hero"> (c) <p id="hero"> (d) <h1 class="box">
Answer key
- makes letters bigger
- packs boxes at the end
- CSS
- yellow
- red
- counts down a timer
- the later one
- 30
- red
- JavaScript
- the screen width
- p
- white
- #
- True
- 800px or wider
- an id selector
- yellow
- 204
- 60
- center
- space-between
- magenta
- blue
- many pages
- 24
- the gap round content
- cyan
- <link>
- 3
- yellow
- 70
- font-family
- Yes
- red
- 118
- #ffffff
- 20
- 24
- <p id="hero">
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids