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 language puts a picture on a page? (a) HTML (b) CSS (c) JavaScript
- 2.✍️ How does a CSS comment start? (a) # (b) <!-- (c) /* (d) //
- 3.⚖️ Which selector is the weakest? (a) a class selector (b) an id selector (c) an element selector
- 4.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the later one (b) neither (c) the shorter one (d) the first one
-
5.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 170px;
padding: 25px;
border: 4px solid black;
margin: 0px;
} - 6.📱 Responsive design means a page ___. (a) is only for laptops (b) has no pictures (c) fits every screen (d) never changes
-
7.⚖️ What colour is the text of this element?
<h2 class="star" id="logo">Hi</h2>
CSS:
h2 { color: black; }
h2 { color: yellow; } (a) green (b) black (c) yellow (d) blue - 8.🌈 Which colour is #0000ff? (a) cyan (b) blue (c) white (d) black
-
9.🖌️ What colour are the letters?
h1 {
color: orange;
font-size: 20px;
background-color: yellow;
text-align: left;
} (a) black (b) orange (c) yellow - 10.🖌️ Which CSS property colours behind the text? (a) font-weight (b) font-family (c) background-color (d) text-align
-
11.🎯 Which CSS selector matches this element?
<p class="note" id="top">Hello</p> (a) h1 (b) p (c) .top (d) #note -
12.⚖️ What colour is the text of this element?
<h2 class="star" id="intro">Hi</h2>
CSS:
.star { color: yellow; }
h2 { color: blue; } (a) blue (b) purple (c) red (d) yellow -
13.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 600px) {
p {
font-size: 8px;
}
} -
14.🖌️ Where does the text sit on its line?
p {
text-align: center;
background-color: orange;
color: blue;
font-size: 36px;
} (a) on the right (b) in the middle (c) on the left -
15.🖌️ Where does the text sit on its line?
h2 {
background-color: orange;
font-size: 16px;
text-align: left;
color: purple;
} (a) on the right (b) in the middle (c) on the left - 16.🌈 Which colour of light is strongest in rgb(10, 189, 90)? (a) green (b) red (c) blue
- 17.What does justify-content: flex-end do? (a) puts boxes in the middle (b) equal gaps, none at ends (c) packs boxes at the end (d) packs boxes at the start
- 18.True or false: the border is the line round the box. (a) False (b) True
- 19.🎨 Which tag connects an outside CSS file? (a) <link> (b) <img> (c) <a> (d) <css>
- 20.🖌️ Which CSS property picks the font style? (a) background-color (b) color (c) font-family (d) font-size
- 21.💪 Which justify-content value packs boxes at the end? (a) space-between (b) center (c) flex-end (d) flex-start
- 22.🎯 Which element does the selector .menu style? (a) <div class="menu"> (b) <div id="menu"> (c) <div class="note"> (d) <span class="big">
-
23.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 40px;
padding: 30px;
border: 5px solid black;
margin: 5px;
} - 24.Which of these does HTML do? (a) rounds box corners (b) reacts to a button click (c) makes headings and lists (d) lays out the page
- 25.🔍 Which is the odd one out? (a) rounds box corners (b) adds space around boxes (c) makes headings and lists (d) sets colours and fonts
-
26.🖌️ How big is the text, in px?
p {
font-size: 24px;
background-color: white;
text-align: left;
color: blue;
} -
27.✍️ How many declarations (property: value pairs) are in this rule?
body {
font-weight: bold;
width: 300px;
} - 28.🌈 Which colour is rgb(255, 255, 255)? (a) magenta (b) yellow (c) red (d) white
- 29.💪 Which flexbox property picks row or column? (a) flex-direction (b) justify-content (c) align-items (d) display: flex
-
30.✍️ Which property is set to 20px in this rule?
body {
font-size: 20px;
text-align: center;
} (a) background-color (b) font-size (c) text-align (d) 20px - 31.Which of these does HTML do? (a) changes the text size (b) puts a picture on a page (c) adds space around boxes (d) sets colours and fonts
-
32.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 360px;
justify-content: flex-start;
}
Inside are 3 boxes, each 100px wide (no margins). - 33.🎯 Which element does the selector span style? (a) <h1 class="note"> (b) <span class="note"> (c) <p> (d) <h2 id="intro">
- 34.🎯 Which element does the selector #intro style? (a) <div class="intro"> (b) <div id="intro"> (c) <span class="big"> (d) <div id="main">
- 35.🌈 Which colour of light is strongest in rgb(39, 46, 223)? (a) red (b) blue (c) green
- 36.🎯 Can many elements share the same class? (a) Yes (b) No
-
37.✍️ Which property is set to 20px in this rule?
.box {
background-color: yellow;
font-style: italic;
font-weight: bold;
font-size: 20px;
} (a) text-align (b) font-size (c) 20px (d) background-color - 38.🌈 Which hex code is yellow? (a) #ffffff (b) #ffff00 (c) #00ff00 (d) #000000
- 39.🌈 In #630000 the red part is the hex number 63. What is it as a normal number?
- 40.📱 What does a media query check? (a) the page title (b) the battery level (c) the time of day (d) the screen width
Answer key
- HTML
- /*
- an element selector
- the later one
- 228
- fits every screen
- yellow
- blue
- orange
- background-color
- p
- yellow
- 8
- in the middle
- on the left
- green
- packs boxes at the end
- True
- <link>
- font-family
- flex-end
- <div class="menu">
- 120
- makes headings and lists
- makes headings and lists
- 24
- 2
- white
- flex-direction
- font-size
- puts a picture on a page
- 60
- <span class="note">
- <div id="intro">
- blue
- Yes
- font-size
- #ffff00
- 99
- the screen width
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids