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.📱 min-width: 800px applies when the screen is ___. (a) exactly 100px (b) 800px or narrower (c) turned off (d) 800px or wider
-
2.✍️ Which property is set to italic in this rule?
p {
background-color: yellow;
padding: 8px;
font-style: italic;
} (a) font-size (b) font-style (c) color (d) italic -
3.✍️ How many declarations (property: value pairs) are in this rule?
h1 {
font-weight: bold;
} - 4.Which of these is padding? (a) space outside the border (b) a solid or dotted edge (c) space inside the border (d) the text or picture
- 5.🎯 What kind of selector is #hero? (a) an element selector (b) an id selector (c) a class selector
-
6.⚖️ What colour is the text of this element?
<h1 class="box" id="hero">Hi</h1>
CSS:
h1 { color: red; }
h1 { color: blue; } (a) red (b) blue (c) black (d) white - 7.🎯 What kind of selector is .menu? (a) a class selector (b) an element selector (c) an id selector
- 8.🎯 Which element does the selector #logo style? (a) <h1 id="logo"> (b) <h1 class="logo"> (c) <h1 id="end"> (d) <h2 class="big">
- 9.🌈 In #006100 the green part is the hex number 61. What is it as a normal number?
- 10.True or false: margin is space outside the border. (a) False (b) True
- 11.🔍 Which is the odd one out? (a) makes headings and lists (b) changes the page live (c) reacts to a button click (d) checks a quiz answer
- 12.🎨 Which tag connects an outside CSS file? (a) <a> (b) <link> (c) <img> (d) <css>
- 13.🌈 Which hex code is magenta? (a) #00ffff (b) #ff0000 (c) #000000 (d) #ff00ff
- 14.🎯 Which element does the selector .star style? (a) <p class="menu"> (b) <p id="star"> (c) <h1 class="note"> (d) <p class="star">
- 15.🎯 Which element does the selector h2 style? (a) <span id="top"> (b) <li> (c) <div class="red"> (d) <h2 class="red">
- 16.True or false: .big is an element selector. (a) False (b) True
- 17.Which of these does CSS do? (a) adds space around boxes (b) puts a picture on a page (c) makes a link (d) makes headings and lists
-
18.✍️ Which property is set to yellow in this rule?
body {
background-color: yellow;
font-style: italic;
} (a) background-color (b) padding (c) yellow (d) margin - 19.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) neither (c) the later one (d) the first one
-
20.⚖️ What colour is the text of this element?
<h1 class="note" id="main">Hi</h1>
CSS:
h1 { color: orange; }
.note { color: blue; }
#main { color: red; } (a) blue (b) orange (c) purple (d) red -
21.⚖️ What colour is the text of this element?
<p class="star" id="end">Hi</p>
CSS:
.star { color: white; }
#end { color: orange; } (a) blue (b) purple (c) orange (d) white - 22.🎯 Which element does the selector .menu style? (a) <h2 id="menu"> (b) <li class="big"> (c) <h2 class="note"> (d) <h2 class="menu">
- 23.What does font-weight do? (a) sets the letter colour (b) centres a heading (c) makes the text bold (d) colours behind the text
- 24.🧩 Which language reacts to a button click? (a) HTML (b) CSS (c) JavaScript
-
25.⚖️ What colour is the text of this element?
<h2 class="box" id="logo">Hi</h2>
CSS:
h2 { color: orange; }
.box { color: blue; } (a) blue (b) purple (c) yellow (d) orange -
26.⚖️ What colour is the text of this element?
<h1 class="note" id="logo">Hi</h1>
CSS:
h1 { color: white; }
#logo { color: black; } (a) green (b) white (c) black (d) blue - 27.📦 In the box model, which part is the gap round content? (a) border (b) content (c) padding (d) margin
- 28.What does text-align do? (a) picks the font style (b) centres a heading (c) makes letters bigger (d) sets the letter colour
-
29.🖌️ How big is the text, in px?
h1 {
color: black;
background-color: yellow;
text-align: right;
font-size: 16px;
} - 30.🌈 In #rrggbb, which colour do the first two digits give? (a) green (b) black (c) blue (d) red
- 31.✍️ Which sign goes between a property and its value? (a) = (b) ; (c) - (d) :
- 32.⚖️ Which selector is the strongest? (a) an id selector (b) an element selector (c) a class selector
- 33.🎯 Which element does the selector #end style? (a) <li class="big"> (b) <h2 id="end"> (c) <h2 class="end"> (d) <h2 id="hero">
- 34.True or false: JavaScript reacts to a button click. (a) True (b) False
- 35.✍️ In color: blue; which part is the property? (a) : (b) color (c) blue (d) ;
- 36.True or false: CSS shows a pop-up message. (a) True (b) False
-
37.✍️ What value is given to background-color in this rule?
p {
width: 300px;
padding: 8px;
background-color: yellow;
text-align: center;
} (a) background-color (b) 10px (c) 8px (d) yellow - 38.What does font-size do? (a) colours behind the text (b) makes letters bigger (c) picks the font style (d) sets the letter colour
-
39.✍️ What is the selector in this CSS rule?
p {
font-weight: bold;
margin: 10px;
} (a) p (b) font-weight (c) 10px (d) .note -
40.✍️ What is the selector in this CSS rule?
p {
font-weight: bold;
text-align: center;
font-size: 20px;
margin: 10px;
} (a) p (b) center (c) font-weight (d) .note
Answer key
- 800px or wider
- font-style
- 1
- space inside the border
- an id selector
- blue
- a class selector
- <h1 id="logo">
- 97
- True
- makes headings and lists
- <link>
- #ff00ff
- <p class="star">
- <h2 class="red">
- False
- adds space around boxes
- background-color
- the later one
- red
- orange
- <h2 class="menu">
- makes the text bold
- JavaScript
- blue
- black
- padding
- centres a heading
- 16
- red
- :
- an id selector
- <h2 id="end">
- True
- color
- False
- yellow
- makes letters bigger
- p
- p
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids