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 hex code is cyan? (a) #00ffff (b) #ffff00 (c) #0000ff (d) #ff00ff
-
2.⚖️ What colour is the text of this element?
<p class="red" id="top">Hi</p>
CSS:
p { color: green; }
p { color: purple; } (a) orange (b) blue (c) purple (d) green - 3.🌈 In #190000 the red part is the hex number 19. What is it as a normal number?
- 4.🧩 Which language puts a picture on a page? (a) CSS (b) HTML (c) JavaScript
- 5.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 4 (b) 3 (c) 2 (d) 6
- 6.🧩 Which language gives the page structure? (a) CSS (b) HTML (c) JavaScript
-
7.🖌️ What colour is behind the letters?
h1 {
color: yellow;
font-size: 16px;
background-color: black;
text-align: center;
} (a) yellow (b) green (c) black -
8.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (min-width: 1024px) {
p {
font-size: 14px;
}
} - 9.🌈 In #000055 the blue part is the hex number 55. What is it as a normal number?
- 10.🧩 Which language rounds box corners? (a) HTML (b) CSS (c) JavaScript
- 11.True or false: HTML changes the text size. (a) False (b) True
-
12.⚖️ What colour is the text of this element?
<h1 class="big" id="logo">Hi</h1>
CSS:
h1 { color: red; }
#logo { color: green; } (a) blue (b) green (c) purple (d) red - 13.💪 Which justify-content value equal gaps, none at ends? (a) flex-end (b) center (c) space-between (d) flex-start
- 14.🌈 Which colour is #0000ff? (a) bright green (b) black (c) blue (d) magenta
- 15.True or false: #hero is a class selector. (a) False (b) True
- 16.✍️ How does a CSS comment start? (a) // (b) /* (c) <!-- (d) #
- 17.🌈 Which colour is rgb(0, 255, 255)? (a) white (b) cyan (c) black (d) magenta
-
18.⚖️ What colour is the text of this element?
<h1 class="note" id="hero">Hi</h1>
CSS:
.note { color: green; }
.note { color: purple; } (a) white (b) purple (c) black (d) green - 19.True or false: HTML sets colours and fonts. (a) True (b) False
- 20.✍️ Which sign goes between a property and its value? (a) - (b) : (c) = (d) ;
-
21.✍️ What value is given to background-color in this rule?
p {
text-align: center;
color: red;
background-color: yellow;
} (a) yellow (b) 8px (c) background-color (d) 10px -
22.✍️ How many declarations (property: value pairs) are in this rule?
h1 {
font-weight: bold;
text-align: center;
} - 23.Which of these does CSS do? (a) changes the page live (b) makes headings and lists (c) puts a picture on a page (d) adds space around boxes
- 24.✍️ In color: blue; which part is the value? (a) color (b) ; (c) blue (d) :
- 25.Which of these is the content? (a) the line round the box (b) a solid or dotted edge (c) the text or picture (d) the gap round content
-
26.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 160px;
justify-content: space-between;
}
Inside are 2 boxes, each 50px wide (no margins). - 27.🎯 What kind of selector is #main? (a) an element selector (b) a class selector (c) an id selector
- 28.Which of these is the border? (a) a solid or dotted edge (b) space inside the border (c) space outside the border (d) the gap to other boxes
- 29.Which of these does HTML do? (a) shows a pop-up message (b) reacts to a button click (c) puts a picture on a page (d) changes the page live
-
30.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 1024px) {
p {
font-size: 8px;
}
} - 31.Which of these does JavaScript do? (a) sets colours and fonts (b) counts down a timer (c) makes headings and lists (d) lays out the page
-
32.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 600px) {
p {
font-size: 10px;
}
} -
33.⚖️ What colour is the text of this element?
<p class="red" id="logo">Hi</p>
CSS:
.red { color: purple; }
#logo { color: orange; }
p { color: white; } (a) white (b) red (c) orange (d) purple -
34.🎯 Which CSS selector matches this element?
<div class="menu" id="intro">Hello</div> (a) div (b) #menu (c) #main (d) span - 35.🎨 Which tag connects an outside CSS file? (a) <link> (b) <css> (c) <a> (d) <img>
- 36.📱 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
-
37.⚖️ What colour is the text of this element?
<p class="star" id="top">Hi</p>
CSS:
#top { color: green; }
.star { color: yellow; }
p { color: white; } (a) blue (b) yellow (c) white (d) green -
38.🎯 Which CSS selector matches this element?
<h1 class="big" id="main">Hello</h1> (a) #big (b) h1 (c) #logo (d) .red - 39.📦 In the box model, which part is the text or picture? (a) content (b) border (c) padding (d) margin
- 40.✍️ CSS declarations go inside which brackets? (a) < > (b) { } (c) ( ) (d) [ ]
Answer key
- #00ffff
- purple
- 25
- HTML
- 3
- HTML
- black
- 12
- 85
- CSS
- False
- green
- space-between
- blue
- False
- /*
- cyan
- purple
- False
- :
- yellow
- 2
- adds space around boxes
- blue
- the text or picture
- 60
- an id selector
- a solid or dotted edge
- puts a picture on a page
- 8
- counts down a timer
- 12
- orange
- div
- <link>
- the viewport meta tag
- green
- h1
- content
- { }
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids