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 justify-content value equal gaps, none at ends? (a) flex-end (b) center (c) space-between (d) flex-start
- 2.⚖️ Which selector is the weakest? (a) an element selector (b) an id selector (c) a class selector
- 3.Which of these does JavaScript do? (a) makes a link (b) makes a form box (c) makes headings and lists (d) changes the page live
- 4.🌈 Which colour of light is strongest in rgb(82, 182, 49)? (a) blue (b) red (c) green
- 5.🎯 Can many elements share the same class? (a) Yes (b) No
- 6.🎨 One CSS file can style how many pages? (a) only one image (b) no pages (c) many pages (d) only one word
- 7.What does font-weight do? (a) makes letters bigger (b) makes the text bold (c) colours behind the text (d) sets the letter colour
- 8.What does justify-content: flex-end do? (a) packs boxes at the end (b) puts boxes in the middle (c) packs boxes at the start (d) equal gaps, none at ends
- 9.💪 Which justify-content value packs boxes at the start? (a) space-between (b) flex-end (c) flex-start (d) center
-
10.✍️ What is the selector in this CSS rule?
p {
font-style: italic;
width: 300px;
font-weight: bold;
} (a) .note (b) 300px (c) p (d) font-style -
11.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 190px;
justify-content: flex-end;
}
Inside are 2 boxes, each 60px wide (no margins). -
12.✍️ Which property is set to 300px in this rule?
.note {
color: red;
width: 300px;
} (a) 300px (b) color (c) width (d) font-style - 13.Which of these does HTML do? (a) rounds box corners (b) counts down a timer (c) lays out the page (d) makes headings and lists
-
14.✍️ What value is given to color in this rule?
.box {
border: 2px solid;
color: red;
text-align: center;
margin: 10px;
} (a) 20px (b) red (c) center (d) color - 15.📦 In the box model, which part is the line round the box? (a) border (b) margin (c) content (d) padding
- 16.📦 In the box model, which part is the gap to other boxes? (a) padding (b) border (c) content (d) margin
- 17.🌈 Which colour is #ffff00? (a) yellow (b) red (c) bright green (d) black
- 18.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) the later one (c) neither (d) the first one
-
19.⚖️ What colour is the text of this element?
<h2 class="box" id="top">Hi</h2>
CSS:
h2 { color: blue; }
h2 { color: green; } (a) green (b) blue (c) red (d) yellow -
20.⚖️ What colour is the text of this element?
<h2 class="star" id="end">Hi</h2>
CSS:
.star { color: yellow; }
.star { color: blue; } (a) purple (b) blue (c) green (d) yellow -
21.✍️ What value is given to width in this rule?
h1 {
color: red;
background-color: yellow;
width: 300px;
border: 2px solid;
} (a) italic (b) 300px (c) red (d) width -
22.🎯 Which CSS selector matches this element?
<h2 class="menu" id="intro">Hello</h2> (a) .menu (b) li (c) #main (d) #menu - 23.🌈 In #000000 the red part is the hex number 00. What is it as a normal number?
-
24.✍️ How many declarations (property: value pairs) are in this rule?
p {
color: red;
} -
25.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 160px;
justify-content: center;
}
Inside are 2 boxes, each 40px wide (no margins). -
26.⚖️ What colour is the text of this element?
<h2 class="red" id="top">Hi</h2>
CSS:
h2 { color: green; }
h2 { color: orange; } (a) purple (b) orange (c) red (d) green - 27.🎯 What kind of selector is #logo? (a) an element selector (b) a class selector (c) an id selector
-
28.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 260px;
justify-content: center;
}
Inside are 3 boxes, each 80px wide (no margins). - 29.🌈 Which colour of light is strongest in rgb(199, 84, 139)? (a) red (b) blue (c) green
- 30.📱 min-width: 800px applies when the screen is ___. (a) 800px or wider (b) turned off (c) 800px or narrower (d) exactly 100px
- 31.What does text-align do? (a) picks the font style (b) colours behind the text (c) sets the letter colour (d) centres a heading
-
32.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (min-width: 1024px) {
p {
font-size: 24px;
}
} - 33.🌈 In #00e100 the green part is the hex number e1. What is it as a normal number?
-
34.📱 The screen is 1100px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (min-width: 480px) {
p {
font-size: 24px;
}
} (a) No (b) Yes - 35.🌈 Which colour of light is strongest in rgb(0, 211, 68)? (a) blue (b) green (c) red
- 36.🎯 Which element does the selector div style? (a) <p class="big"> (b) <div class="big"> (c) <span> (d) <h1 id="intro">
- 37.🌈 Which hex code is white? (a) #0000ff (b) #000000 (c) #ffffff (d) #ffff00
- 38.✍️ In color: blue; which part is the value? (a) : (b) color (c) ; (d) blue
-
39.🖌️ What colour are the letters?
h1 {
color: black;
font-size: 20px;
background-color: purple;
text-align: center;
} (a) purple (b) white (c) black -
40.📱 The screen is 414px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (min-width: 480px) {
p {
font-size: 18px;
}
} (a) No (b) Yes
Answer key
- space-between
- an element selector
- changes the page live
- green
- Yes
- many pages
- makes the text bold
- packs boxes at the end
- flex-start
- p
- 70
- width
- makes headings and lists
- red
- border
- margin
- yellow
- the later one
- green
- blue
- 300px
- .menu
- 0
- 1
- 40
- orange
- an id selector
- 10
- red
- 800px or wider
- centres a heading
- 24
- 225
- Yes
- green
- <div class="big">
- #ffffff
- blue
- black
- No
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids