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.🌈 In #000063 the blue part is the hex number 63. What is it as a normal number?
-
2.✍️ Which property is set to center in this rule?
.box {
margin: 10px;
border: 2px solid;
color: red;
text-align: center;
} (a) margin (b) text-align (c) background-color (d) center - 3.🎯 Which element does the selector .note style? (a) <li class="big"> (b) <li id="note"> (c) <li class="note"> (d) <div class="red">
- 4.🌈 In #ac0000 the red part is the hex number ac. What is it as a normal number?
-
5.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 230px;
justify-content: space-between;
}
Inside are 3 boxes, each 50px wide (no margins). - 6.✍️ In color: blue; which part is the value? (a) blue (b) : (c) ; (d) color
- 7.🎯 Which element does the selector #main style? (a) <li id="logo"> (b) <li id="main"> (c) <li class="main"> (d) <div class="big">
-
8.✍️ Which property is set to 10px in this rule?
li {
margin: 10px;
border: 2px solid;
} (a) margin (b) font-weight (c) 10px (d) padding - 9.🎨 Which attribute adds CSS inside one tag? (a) href (b) src (c) style (d) alt
- 10.🎯 Which sign starts a class selector? (a) . (b) @ (c) # (d) &
- 11.🧩 Which language counts down a timer? (a) HTML (b) CSS (c) JavaScript
- 12.🌈 Which colour is rgb(0, 0, 255)? (a) blue (b) magenta (c) red (d) bright green
- 13.🌈 Which colour is rgb(255, 0, 0)? (a) red (b) blue (c) magenta (d) white
- 14.True or false: CSS changes the page live. (a) True (b) False
-
15.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 180px;
justify-content: flex-start;
}
Inside are 2 boxes, each 80px wide (no margins). -
16.⚖️ What colour is the text of this element?
<h2 class="note" id="end">Hi</h2>
CSS:
h2 { color: red; }
h2 { color: blue; } (a) orange (b) red (c) white (d) blue - 17.🧩 Which language lays out the page? (a) HTML (b) CSS (c) JavaScript
-
18.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 90px;
padding: 5px;
border: 2px solid black;
margin: 20px;
} -
19.🖌️ Where does the text sit on its line?
h1 {
background-color: orange;
text-align: center;
font-size: 24px;
color: yellow;
} (a) on the left (b) on the right (c) in the middle -
20.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 120px;
justify-content: flex-start;
}
Inside are 2 boxes, each 50px wide (no margins). - 21.Which of these does JavaScript do? (a) lays out the page (b) makes a form box (c) changes the text size (d) shows a pop-up message
- 22.✍️ In color: blue; which part is the property? (a) color (b) ; (c) : (d) blue
- 23.📦 In the box model, which part is the line round the box? (a) content (b) padding (c) border (d) margin
- 24.🖌️ Which CSS property makes letters bigger? (a) text-align (b) font-family (c) font-size (d) font-weight
- 25.🔍 Which is the odd one out? (a) checks a quiz answer (b) reacts to a button click (c) shows a pop-up message (d) gives the page structure
- 26.⚖️ Which selector is the strongest? (a) an element selector (b) a class selector (c) an id selector
- 27.🎯 What kind of selector is #logo? (a) an id selector (b) a class selector (c) an element selector
-
28.⚖️ What colour is the text of this element?
<p class="red" id="hero">Hi</p>
CSS:
.red { color: yellow; }
p { color: purple; } (a) red (b) white (c) yellow (d) purple -
29.🖌️ Where does the text sit on its line?
h1 {
color: black;
background-color: red;
font-size: 36px;
text-align: right;
} (a) on the right (b) on the left (c) in the middle - 30.📱 What does a media query check? (a) the page title (b) the screen width (c) the time of day (d) the battery level
- 31.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 6 (b) 4 (c) 3 (d) 2
- 32.True or false: the border is the gap round content. (a) False (b) True
-
33.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 260px;
justify-content: flex-start;
}
Inside are 4 boxes, each 50px wide (no margins). -
34.🖌️ What colour is behind the letters?
h2 {
color: purple;
background-color: yellow;
text-align: left;
font-size: 36px;
} (a) black (b) purple (c) yellow - 35.🌈 Hex digits go 0 to 9, then A to which letter? (a) Z (b) F (c) G (d) J
-
36.✍️ How many declarations (property: value pairs) are in this rule?
p {
font-weight: bold;
font-style: italic;
text-align: center;
margin: 10px;
} -
37.🖌️ Where does the text sit on its line?
h1 {
background-color: white;
color: green;
font-size: 20px;
text-align: right;
} (a) on the left (b) on the right (c) in the middle - 38.💪 Which justify-content value equal gaps, none at ends? (a) flex-end (b) center (c) flex-start (d) space-between
-
39.⚖️ What colour is the text of this element?
<h2 class="star" id="top">Hi</h2>
CSS:
#top { color: green; }
#top { color: yellow; } (a) green (b) black (c) yellow (d) blue - 40.🎯 Which element does the selector li style? (a) <div> (b) <li class="box"> (c) <span class="box"> (d) <p id="main">
Answer key
- 99
- text-align
- <li class="note">
- 172
- 40
- blue
- <li id="main">
- margin
- style
- .
- JavaScript
- blue
- red
- False
- 20
- blue
- CSS
- 144
- in the middle
- 20
- shows a pop-up message
- color
- border
- font-size
- gives the page structure
- an id selector
- an id selector
- yellow
- on the right
- the screen width
- 3
- False
- 60
- yellow
- F
- 4
- on the right
- space-between
- yellow
- <li class="box">
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids