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 colour is the text of this element?
<h1 class="star" id="hero">Hi</h1>
CSS:
#hero { color: white; }
#hero { color: yellow; } (a) purple (b) white (c) yellow (d) green -
2.✍️ Which property is set to 8px in this rule?
li {
background-color: yellow;
font-style: italic;
font-weight: bold;
padding: 8px;
} (a) padding (b) border (c) font-weight (d) 8px - 3.✍️ Which sign goes between a property and its value? (a) ; (b) = (c) - (d) :
- 4.💪 Which flexbox property sets space between boxes? (a) display: flex (b) gap (c) flex-direction (d) align-items
- 5.Which of these is padding? (a) the gap to other boxes (b) space outside the border (c) a solid or dotted edge (d) the gap round content
-
6.⚖️ What colour is the text of this element?
<p class="big" id="hero">Hi</p>
CSS:
p { color: green; }
p { color: orange; } (a) orange (b) white (c) purple (d) green - 7.True or false: HTML reacts to a button click. (a) True (b) False
-
8.🎯 Which CSS selector matches this element?
<span class="note" id="top">Hello</span> (a) #intro (b) .top (c) p (d) .note - 9.What does justify-content: center do? (a) puts boxes in the middle (b) packs boxes at the end (c) packs boxes at the start (d) equal gaps, none at ends
- 10.✍️ How does a CSS comment start? (a) /* (b) <!-- (c) // (d) #
- 11.🌈 Which colour is #000000? (a) black (b) cyan (c) red (d) blue
-
12.✍️ What value is given to font-size in this rule?
#top {
font-size: 20px;
text-align: center;
background-color: yellow;
font-weight: bold;
} (a) yellow (b) 20px (c) center (d) font-size - 13.Which of these does JavaScript do? (a) adds space around boxes (b) reacts to a button click (c) makes a form box (d) makes a link
-
14.⚖️ What colour is the text of this element?
<p class="menu" id="intro">Hi</p>
CSS:
p { color: yellow; }
p { color: purple; } (a) green (b) yellow (c) blue (d) purple - 15.🎯 Can many elements share the same class? (a) No (b) Yes
-
16.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 140px;
justify-content: center;
}
Inside are 2 boxes, each 50px wide (no margins). - 17.🎨 Which tag connects an outside CSS file? (a) <css> (b) <img> (c) <a> (d) <link>
-
18.✍️ Which property is set to 2px solid in this rule?
li {
text-align: center;
border: 2px solid;
font-size: 20px;
width: 300px;
} (a) 2px solid (b) border (c) font-style (d) width - 19.⚖️ Which selector is the weakest? (a) a class selector (b) an element selector (c) an id selector
-
20.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 210px;
padding: 10px;
border: 4px solid black;
margin: 20px;
} -
21.🎯 Which CSS selector matches this element?
<h1 class="star" id="intro">Hello</h1> (a) #main (b) h2 (c) .intro (d) #intro -
22.✍️ How many declarations (property: value pairs) are in this rule?
li {
background-color: yellow;
} - 23.🌈 In #d30000 the red part is the hex number d3. What is it as a normal number?
-
24.⚖️ What colour is the text of this element?
<h2 class="note" id="top">Hi</h2>
CSS:
h2 { color: red; }
#top { color: yellow; }
.note { color: purple; } (a) black (b) red (c) purple (d) yellow - 25.🌈 Which colour of light is strongest in rgb(13, 139, 195)? (a) red (b) green (c) blue
- 26.Which of these does CSS do? (a) makes a link (b) gives the page structure (c) shows a pop-up message (d) changes the text size
- 27.💪 Which justify-content value packs boxes at the end? (a) center (b) flex-start (c) flex-end (d) space-between
- 28.True or false: JavaScript makes a form box. (a) True (b) False
- 29.🎯 Which sign starts a class selector? (a) & (b) . (c) @ (d) #
- 30.🌈 Which hex code is black? (a) #ffff00 (b) #ff0000 (c) #ff00ff (d) #000000
-
31.✍️ What is the selector in this CSS rule?
p {
padding: 8px;
border: 2px solid;
font-style: italic;
text-align: center;
} (a) .note (b) padding (c) 2px solid (d) p -
32.✍️ How many declarations (property: value pairs) are in this rule?
.note {
text-align: center;
font-weight: bold;
padding: 8px;
} - 33.🔍 Which is the odd one out? (a) checks a quiz answer (b) changes the page live (c) adds space around boxes (d) counts down a timer
- 34.🎯 Which element does the selector #hero style? (a) <h1 id="top"> (b) <h1 class="hero"> (c) <h1 id="hero"> (d) <h2 class="big">
- 35.🌈 In #rrggbb, which colour do the first two digits give? (a) green (b) red (c) black (d) blue
- 36.✍️ Which sign ends each CSS declaration? (a) : (b) , (c) . (d) ;
-
37.🖌️ What colour are the letters?
p {
background-color: green;
font-size: 20px;
text-align: right;
color: red;
} (a) black (b) green (c) red -
38.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (min-width: 1024px) {
p {
font-size: 28px;
}
} -
39.⚖️ What colour is the text of this element?
<p class="big" id="intro">Hi</p>
CSS:
p { color: green; }
#intro { color: purple; }
.big { color: orange; } (a) purple (b) green (c) red (d) orange - 40.🌈 Which colour is rgb(0, 255, 0)? (a) yellow (b) magenta (c) black (d) bright green
Answer key
- yellow
- padding
- :
- gap
- the gap round content
- orange
- False
- .note
- puts boxes in the middle
- /*
- black
- 20px
- reacts to a button click
- purple
- Yes
- 20
- <link>
- border
- an element selector
- 278
- #intro
- 1
- 211
- yellow
- blue
- changes the text size
- flex-end
- False
- .
- #000000
- p
- 3
- adds space around boxes
- <h1 id="hero">
- red
- ;
- red
- 20
- purple
- bright green
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids