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 is the biggest number one colour can have in rgb()? (a) 100 (b) 255 (c) 99 (d) 1000
- 2.What does justify-content: flex-end 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
- 3.🌈 Which colour is #00ff00? (a) bright green (b) red (c) blue (d) black
-
4.🎯 Which CSS selector matches this element?
<span class="note" id="logo">Hello</span> (a) #note (b) .note (c) p (d) #end -
5.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 260px;
justify-content: flex-start;
}
Inside are 3 boxes, each 80px wide (no margins). - 6.⚖️ Which selector is the strongest? (a) an element selector (b) a class selector (c) an id selector
- 7.📱 Which tag helps phones show a page at the right size? (a) the br tag (b) the hr tag (c) the title tag (d) the viewport meta tag
-
8.✍️ Which property is set to center in this rule?
h1 {
text-align: center;
background-color: yellow;
} (a) margin (b) background-color (c) center (d) text-align -
9.✍️ How many declarations (property: value pairs) are in this rule?
p {
font-weight: bold;
margin: 10px;
} - 10.🌈 Which colour is #ffff00? (a) bright green (b) blue (c) yellow (d) magenta
- 11.🌈 Which hex code is magenta? (a) #ff0000 (b) #ff00ff (c) #00ffff (d) #00ff00
- 12.🎨 Which tag connects an outside CSS file? (a) <img> (b) <a> (c) <link> (d) <css>
- 13.🎯 What kind of selector is .note? (a) an element selector (b) an id selector (c) a class selector
- 14.What does justify-content: flex-start do? (a) packs boxes at the start (b) puts boxes in the middle (c) equal gaps, none at ends (d) packs boxes at the end
- 15.📦 In the box model, which part is the gap round content? (a) border (b) content (c) margin (d) padding
- 16.What does font-weight do? (a) makes letters bigger (b) makes the text bold (c) sets the letter colour (d) colours behind the text
- 17.What does justify-content: center do? (a) equal gaps, none at ends (b) packs boxes at the end (c) packs boxes at the start (d) puts boxes in the middle
-
18.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 100px;
justify-content: center;
}
Inside are 2 boxes, each 40px wide (no margins). - 19.🎨 A CSS file usually ends with which extension? (a) .png (b) .js (c) .html (d) .css
-
20.⚖️ What colour is the text of this element?
<h1 class="note" id="hero">Hi</h1>
CSS:
h1 { color: blue; }
.note { color: yellow; } (a) yellow (b) blue (c) black (d) green -
21.🎯 Which CSS selector matches this element?
<li class="red" id="hero">Hello</li> (a) .box (b) div (c) li (d) #red -
22.🎯 Which CSS selector matches this element?
<div class="red" id="hero">Hello</div> (a) .box (b) #red (c) span (d) #hero - 23.🧩 Which language gives the page structure? (a) HTML (b) JavaScript (c) CSS
- 24.What does font-size do? (a) sets the letter colour (b) makes letters bigger (c) makes the text bold (d) colours behind the text
-
25.✍️ How many declarations (property: value pairs) are in this rule?
h2 {
border: 2px solid;
text-align: center;
} -
26.⚖️ What colour is the text of this element?
<h1 class="note" id="logo">Hi</h1>
CSS:
h1 { color: white; }
.note { color: purple; } (a) red (b) purple (c) black (d) white -
27.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 230px;
justify-content: flex-end;
}
Inside are 3 boxes, each 50px wide (no margins). - 28.🔍 Which is the odd one out? (a) rounds box corners (b) adds space around boxes (c) changes the text size (d) reacts to a button click
- 29.True or false: CSS sets colours and fonts. (a) False (b) True
-
30.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 170px;
justify-content: flex-start;
}
Inside are 4 boxes, each 40px wide (no margins). -
31.⚖️ What colour is the text of this element?
<p class="note" id="intro">Hi</p>
CSS:
#intro { color: yellow; }
p { color: red; } (a) yellow (b) red (c) black (d) orange -
32.✍️ What value is given to text-align in this rule?
#top {
border: 2px solid;
text-align: center;
font-weight: bold;
font-style: italic;
} (a) 10px (b) center (c) text-align (d) yellow -
33.⚖️ What colour is the text of this element?
<h2 class="star" id="top">Hi</h2>
CSS:
.star { color: purple; }
.star { color: orange; } (a) green (b) purple (c) yellow (d) orange - 34.What does font-family do? (a) picks the font style (b) sets the letter colour (c) makes letters bigger (d) colours behind the text
-
35.🖌️ How big is the text, in px?
li {
font-size: 28px;
background-color: white;
color: orange;
text-align: center;
} - 36.✍️ In color: blue; which part is the property? (a) color (b) ; (c) : (d) blue
- 37.🌈 In #rrggbb, which colour do the last two digits give? (a) green (b) red (c) blue (d) white
-
38.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 190px;
justify-content: flex-end;
}
Inside are 4 boxes, each 40px wide (no margins). - 39.🌈 Which colour of light is strongest in rgb(53, 17, 245)? (a) red (b) blue (c) green
-
40.✍️ What value is given to padding in this rule?
h1 {
font-size: 20px;
padding: 8px;
color: red;
} (a) 8px (b) padding (c) bold (d) 2px solid
Answer key
- 255
- packs boxes at the end
- bright green
- .note
- 20
- an id selector
- the viewport meta tag
- text-align
- 2
- yellow
- #ff00ff
- <link>
- a class selector
- packs boxes at the start
- padding
- makes the text bold
- puts boxes in the middle
- 10
- .css
- yellow
- li
- #hero
- HTML
- makes letters bigger
- 2
- purple
- 80
- reacts to a button click
- True
- 10
- yellow
- center
- orange
- picks the font style
- 28
- color
- blue
- 30
- blue
- 8px
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids