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 color: blue; which part is the property? (a) : (b) blue (c) color (d) ;
-
2.🖌️ What colour are the letters?
p {
background-color: blue;
font-size: 40px;
color: black;
text-align: right;
} (a) blue (b) green (c) black - 3.🌈 Which hex code is cyan? (a) #000000 (b) #00ffff (c) #ffffff (d) #ff0000
-
4.⚖️ What colour is the text of this element?
<h1 class="big" id="logo">Hi</h1>
CSS:
h1 { color: blue; }
h1 { color: white; } (a) purple (b) black (c) white (d) blue - 5.🎯 Which element does the selector #main style? (a) <span class="red"> (b) <div id="logo"> (c) <div class="main"> (d) <div id="main">
- 6.🔍 Which is the odd one out? (a) gives the page structure (b) makes a form box (c) reacts to a button click (d) makes headings and lists
-
7.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 100px;
padding: 20px;
border: 4px solid black;
margin: 0px;
} - 8.🎯 What kind of selector is .star? (a) an id selector (b) an element selector (c) a class selector
- 9.💪 Which flexbox property sets space between boxes? (a) display: flex (b) justify-content (c) align-items (d) gap
-
10.🖌️ What colour are the letters?
li {
font-size: 16px;
text-align: left;
color: white;
background-color: purple;
} (a) purple (b) orange (c) white - 11.✍️ How does a CSS comment start? (a) # (b) // (c) <!-- (d) /*
-
12.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 280px;
justify-content: center;
}
Inside are 4 boxes, each 50px wide (no margins). -
13.🖌️ Where does the text sit on its line?
h1 {
text-align: left;
font-size: 16px;
background-color: purple;
color: red;
} (a) in the middle (b) on the right (c) on the left -
14.⚖️ What colour is the text of this element?
<p class="box" id="hero">Hi</p>
CSS:
p { color: purple; }
p { color: orange; } (a) purple (b) yellow (c) orange (d) blue -
15.🖌️ Where does the text sit on its line?
p {
background-color: red;
text-align: left;
color: purple;
font-size: 20px;
} (a) in the middle (b) on the left (c) on the right -
16.✍️ What is the selector in this CSS rule?
.box {
font-size: 20px;
font-weight: bold;
} (a) bold (b) font-size (c) h2 (d) .box - 17.🎯 Which sign starts a class selector? (a) @ (b) & (c) . (d) #
- 18.Which of these does JavaScript do? (a) counts down a timer (b) puts a picture on a page (c) adds space around boxes (d) gives the page structure
-
19.⚖️ What colour is the text of this element?
<h2 class="big" id="intro">Hi</h2>
CSS:
h2 { color: white; }
.big { color: purple; }
#intro { color: black; } (a) yellow (b) white (c) purple (d) black - 20.What does color do? (a) picks the font style (b) makes the text bold (c) sets the letter colour (d) centres a heading
- 21.Which of these does HTML do? (a) shows a pop-up message (b) changes the page live (c) gives the page structure (d) sets colours and fonts
-
22.✍️ How many declarations (property: value pairs) are in this rule?
h2 {
font-style: italic;
width: 300px;
text-align: center;
} -
23.⚖️ What colour is the text of this element?
<h2 class="note" id="end">Hi</h2>
CSS:
#end { color: red; }
h2 { color: orange; } (a) orange (b) red (c) blue (d) green - 24.🎨 Which tag connects an outside CSS file? (a) <a> (b) <img> (c) <link> (d) <css>
- 25.🌈 Which colour of light is strongest in rgb(47, 46, 251)? (a) blue (b) red (c) green
- 26.True or false: CSS lays out the page. (a) True (b) False
-
27.✍️ What value is given to color in this rule?
body {
color: red;
font-size: 20px;
background-color: yellow;
margin: 10px;
} (a) center (b) red (c) color (d) 20px - 28.📱 Which tag helps phones show a page at the right size? (a) the hr tag (b) the br tag (c) the title tag (d) the viewport meta tag
-
29.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 160px;
padding: 30px;
border: 2px solid black;
margin: 15px;
} -
30.🖌️ Where does the text sit on its line?
li {
text-align: right;
color: orange;
background-color: black;
font-size: 12px;
} (a) in the middle (b) on the left (c) on the right -
31.⚖️ What colour is the text of this element?
<h1 class="big" id="intro">Hi</h1>
CSS:
.big { color: green; }
#intro { color: yellow; } (a) red (b) black (c) green (d) yellow -
32.✍️ Which property is set to red in this rule?
body {
text-align: center;
color: red;
padding: 8px;
font-weight: bold;
} (a) font-size (b) text-align (c) red (d) color -
33.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (max-width: 768px) {
p {
font-size: 20px;
}
} - 34.🖌️ Which CSS property picks the font style? (a) text-align (b) font-size (c) background-color (d) font-family
- 35.⚖️ Which selector is the weakest? (a) an id selector (b) an element selector (c) a class selector
- 36.What does font-weight do? (a) picks the font style (b) makes the text bold (c) colours behind the text (d) sets the letter colour
-
37.⚖️ What colour is the text of this element?
<h2 class="box" id="hero">Hi</h2>
CSS:
h2 { color: orange; }
.box { color: blue; } (a) green (b) white (c) blue (d) orange -
38.⚖️ What colour is the text of this element?
<h1 class="star" id="end">Hi</h1>
CSS:
h1 { color: yellow; }
h1 { color: purple; } (a) yellow (b) purple (c) black (d) green - 39.🌈 Which colour is #ffffff? (a) yellow (b) bright green (c) white (d) blue
-
40.🖌️ What colour are the letters?
h1 {
font-size: 20px;
background-color: green;
color: black;
text-align: right;
} (a) green (b) red (c) black
Answer key
- color
- black
- #00ffff
- white
- <div id="main">
- reacts to a button click
- 148
- a class selector
- gap
- white
- /*
- 40
- on the left
- orange
- on the left
- .box
- .
- counts down a timer
- black
- sets the letter colour
- gives the page structure
- 3
- red
- <link>
- blue
- True
- red
- the viewport meta tag
- 224
- on the right
- yellow
- color
- 20
- font-family
- an element selector
- makes the text bold
- blue
- purple
- white
- black
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids