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.📱 The screen is 414px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 1024px) {
p {
font-size: 8px;
}
} (a) Yes (b) No -
2.🖌️ What colour are the letters?
h1 {
text-align: left;
background-color: black;
font-size: 32px;
color: yellow;
} (a) black (b) yellow (c) white -
3.⚖️ What colour is the text of this element?
<h1 class="box" id="intro">Hi</h1>
CSS:
h1 { color: orange; }
h1 { color: white; } (a) red (b) white (c) yellow (d) orange -
4.⚖️ What colour is the text of this element?
<p class="note" id="top">Hi</p>
CSS:
#top { color: red; }
.note { color: black; } (a) blue (b) black (c) red (d) green - 5.True or false: .big is a class selector. (a) False (b) True
- 6.What does font-family do? (a) sets the letter colour (b) makes letters bigger (c) picks the font style (d) centres a heading
- 7.⚖️ Which selector is the strongest? (a) an element selector (b) an id selector (c) a class selector
- 8.True or false: the border is the line round the box. (a) False (b) True
- 9.🎯 What kind of selector is p? (a) an id selector (b) a class selector (c) an element selector
- 10.🎯 How many elements on a page should have the same id? (a) 2 (b) any number (c) 5 (d) 1
-
11.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 250px;
justify-content: flex-start;
}
Inside are 4 boxes, each 50px wide (no margins). -
12.⚖️ What colour is the text of this element?
<h1 class="red" id="main">Hi</h1>
CSS:
.red { color: orange; }
.red { color: green; } (a) green (b) white (c) orange (d) black -
13.⚖️ What colour is the text of this element?
<p class="note" id="hero">Hi</p>
CSS:
.note { color: white; }
#hero { color: black; } (a) black (b) white (c) yellow (d) red - 14.📱 What does a media query check? (a) the page title (b) the time of day (c) the battery level (d) the screen width
- 15.What does justify-content: space-between do? (a) packs boxes at the end (b) puts boxes in the middle (c) equal gaps, none at ends (d) packs boxes at the start
-
16.⚖️ What colour is the text of this element?
<h1 class="note" id="logo">Hi</h1>
CSS:
h1 { color: blue; }
h1 { color: green; } (a) green (b) purple (c) blue (d) orange -
17.🎯 Which CSS selector matches this element?
<p class="star" id="logo">Hello</p> (a) h1 (b) #end (c) .logo (d) .star - 18.🎯 What kind of selector is li? (a) a class selector (b) an id selector (c) an element selector
-
19.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 250px;
padding: 10px;
border: 1px solid black;
margin: 15px;
} - 20.🔍 Which is the odd one out? (a) rounds box corners (b) changes the page live (c) lays out the page (d) adds space around boxes
-
21.✍️ What value is given to background-color in this rule?
h1 {
font-style: italic;
background-color: yellow;
} (a) 8px (b) 10px (c) background-color (d) yellow - 22.True or false: #hero is an element selector. (a) False (b) True
- 23.True or false: li is a class selector. (a) False (b) True
- 24.🎯 What kind of selector is .card? (a) an element selector (b) a class selector (c) an id selector
-
25.🎯 Which CSS selector matches this element?
<h2 class="red" id="logo">Hello</h2> (a) #red (b) .red (c) .logo (d) li -
26.✍️ How many declarations (property: value pairs) are in this rule?
p {
font-style: italic;
} - 27.🌈 Which colour of light is strongest in rgb(180, 80, 68)? (a) red (b) blue (c) green
-
28.✍️ What value is given to margin in this rule?
p {
margin: 10px;
font-weight: bold;
} (a) margin (b) 8px (c) bold (d) 10px - 29.🌈 Which colour of light is strongest in rgb(180, 134, 54)? (a) red (b) blue (c) green
- 30.Which of these does JavaScript do? (a) puts a picture on a page (b) changes the page live (c) sets colours and fonts (d) changes the text size
- 31.What does text-align do? (a) picks the font style (b) makes the text bold (c) sets the letter colour (d) centres a heading
-
32.✍️ What value is given to margin in this rule?
p {
border: 2px solid;
margin: 10px;
color: red;
} (a) 8px (b) bold (c) 10px (d) margin -
33.✍️ How many declarations (property: value pairs) are in this rule?
body {
margin: 10px;
} -
34.⚖️ What colour is the text of this element?
<p class="big" id="hero">Hi</p>
CSS:
#hero { color: yellow; }
p { color: black; } (a) black (b) blue (c) orange (d) yellow - 35.Which of these does JavaScript do? (a) makes a form box (b) lays out the page (c) sets colours and fonts (d) checks a quiz answer
- 36.🧩 Which language changes the text size? (a) HTML (b) CSS (c) JavaScript
- 37.What does font-size do? (a) makes letters bigger (b) sets the letter colour (c) picks the font style (d) makes the text bold
-
38.✍️ What is the selector in this CSS rule?
.note {
background-color: yellow;
font-size: 20px;
} (a) #top (b) 20px (c) background-color (d) .note - 39.🧩 Which language makes a form box? (a) CSS (b) JavaScript (c) HTML
- 40.🧩 Which language makes a link? (a) JavaScript (b) CSS (c) HTML
Answer key
- Yes
- yellow
- white
- red
- True
- picks the font style
- an id selector
- True
- an element selector
- 1
- 50
- green
- black
- the screen width
- equal gaps, none at ends
- green
- .star
- an element selector
- 272
- changes the page live
- yellow
- False
- False
- a class selector
- .red
- 1
- red
- 10px
- red
- changes the page live
- centres a heading
- 10px
- 1
- yellow
- checks a quiz answer
- CSS
- makes letters bigger
- .note
- HTML
- HTML
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids