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="end">Hi</h1>
CSS:
h1 { color: red; }
.star { color: white; }
#end { color: yellow; } (a) red (b) yellow (c) blue (d) white -
2.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 600px) {
p {
font-size: 6px;
}
} - 3.🎯 Which element does the selector .box style? (a) <h1 class="menu"> (b) <p id="box"> (c) <p class="star"> (d) <p class="box">
- 4.What does color do? (a) picks the font style (b) centres a heading (c) sets the letter colour (d) makes the text bold
-
5.⚖️ What colour is the text of this element?
<h1 class="note" id="end">Hi</h1>
CSS:
#end { color: black; }
#end { color: yellow; } (a) black (b) green (c) yellow (d) blue - 6.🌈 Which colour of light is strongest in rgb(29, 219, 115)? (a) green (b) red (c) blue
- 7.✍️ How does a CSS comment start? (a) # (b) // (c) <!-- (d) /*
-
8.🖌️ What colour are the letters?
li {
font-size: 12px;
background-color: blue;
color: green;
text-align: right;
} (a) blue (b) white (c) green - 9.🌈 Which hex code is cyan? (a) #00ff00 (b) #00ffff (c) #ff0000 (d) #000000
- 10.🌈 In #910000 the red part is the hex number 91. What is it as a normal number?
-
11.⚖️ What colour is the text of this element?
<h1 class="menu" id="logo">Hi</h1>
CSS:
h1 { color: purple; }
h1 { color: white; } (a) yellow (b) white (c) purple (d) orange - 12.💪 Which flexbox property turns on flexbox? (a) align-items (b) display: flex (c) justify-content (d) gap
-
13.⚖️ What colour is the text of this element?
<p class="menu" id="top">Hi</p>
CSS:
p { color: white; }
p { color: black; } (a) red (b) white (c) orange (d) black -
14.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (min-width: 1024px) {
p {
font-size: 24px;
}
} -
15.✍️ How many declarations (property: value pairs) are in this rule?
h1 {
background-color: yellow;
font-size: 20px;
} - 16.Which of these does HTML do? (a) puts a picture on a page (b) sets colours and fonts (c) adds space around boxes (d) reacts to a button click
-
17.✍️ How many declarations (property: value pairs) are in this rule?
p {
background-color: yellow;
} -
18.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 480px) {
p {
font-size: 24px;
}
} -
19.⚖️ What colour is the text of this element?
<p class="star" id="top">Hi</p>
CSS:
.star { color: orange; }
.star { color: red; } (a) orange (b) green (c) red (d) yellow -
20.✍️ What is the selector in this CSS rule?
p {
width: 300px;
text-align: center;
padding: 8px;
background-color: yellow;
} (a) p (b) center (c) width (d) .note - 21.Which of these does HTML do? (a) reacts to a button click (b) counts down a timer (c) gives the page structure (d) shows a pop-up message
- 22.✍️ In color: blue; which part is the value? (a) : (b) ; (c) color (d) blue
- 23.📦 In the box model, which part is the text or picture? (a) margin (b) content (c) border (d) padding
-
24.🎯 Which CSS selector matches this element?
<p class="star" id="intro">Hello</p> (a) .star (b) .menu (c) #star (d) h1 - 25.💪 Which flexbox property lines boxes up across? (a) flex-direction (b) justify-content (c) display: flex (d) align-items
- 26.💪 Which flexbox property picks row or column? (a) display: flex (b) justify-content (c) flex-direction (d) align-items
- 27.🔍 Which is the odd one out? (a) sets colours and fonts (b) checks a quiz answer (c) rounds box corners (d) changes the text size
- 28.What does background-color do? (a) colours behind the text (b) centres a heading (c) sets the letter colour (d) makes letters bigger
-
29.⚖️ What colour is the text of this element?
<h1 class="star" id="top">Hi</h1>
CSS:
#top { color: black; }
#top { color: blue; } (a) orange (b) black (c) white (d) blue -
30.✍️ How many declarations (property: value pairs) are in this rule?
.note {
padding: 8px;
background-color: yellow;
} - 31.⚖️ Which selector is the weakest? (a) an id selector (b) a class selector (c) an element selector
- 32.🧩 Which language lays out the page? (a) HTML (b) JavaScript (c) CSS
- 33.📱 Which tag helps phones show a page at the right size? (a) the hr tag (b) the viewport meta tag (c) the br tag (d) the title tag
- 34.True or false: li is an element selector. (a) True (b) False
- 35.True or false: the content is space inside the border. (a) False (b) True
- 36.🖌️ Which CSS property makes the text bold? (a) background-color (b) text-align (c) font-weight (d) color
-
37.✍️ What value is given to padding in this rule?
.box {
width: 300px;
font-size: 20px;
text-align: center;
padding: 8px;
} (a) 8px (b) padding (c) 2px solid (d) bold -
38.📱 The screen is 1366px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (min-width: 600px) {
p {
font-size: 14px;
}
} (a) No (b) Yes - 39.🎯 Which element does the selector li style? (a) <div> (b) <span class="box"> (c) <p id="intro"> (d) <li class="box">
- 40.🔍 Which is the odd one out? (a) makes a link (b) makes headings and lists (c) sets colours and fonts (d) makes a form box
Answer key
- yellow
- 12
- <p class="box">
- sets the letter colour
- yellow
- green
- /*
- green
- #00ffff
- 145
- white
- display: flex
- black
- 20
- 2
- puts a picture on a page
- 1
- 16
- red
- p
- gives the page structure
- blue
- content
- .star
- align-items
- flex-direction
- checks a quiz answer
- colours behind the text
- blue
- 2
- an element selector
- CSS
- the viewport meta tag
- True
- False
- font-weight
- 8px
- Yes
- <li class="box">
- sets colours and fonts
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids