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?
<h2 class="box" id="logo">Hi</h2>
CSS:
.box { color: purple; }
.box { color: orange; } (a) black (b) orange (c) yellow (d) purple - 2.⚖️ Which selector is the weakest? (a) a class selector (b) an element selector (c) an id selector
- 3.🧩 Which language makes a form box? (a) CSS (b) HTML (c) JavaScript
- 4.⚖️ Which selector is the strongest? (a) an id selector (b) an element selector (c) a class selector
-
5.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 160px;
justify-content: flex-start;
}
Inside are 3 boxes, each 40px wide (no margins). -
6.⚖️ What colour is the text of this element?
<h1 class="red" id="main">Hi</h1>
CSS:
.red { color: blue; }
.red { color: green; } (a) black (b) orange (c) blue (d) green - 7.🎨 Which tag connects an outside CSS file? (a) <img> (b) <link> (c) <a> (d) <css>
- 8.🧩 Which language lays out the page? (a) JavaScript (b) CSS (c) HTML
- 9.✍️ Which sign goes between a property and its value? (a) = (b) : (c) - (d) ;
- 10.📱 What does a media query check? (a) the battery level (b) the time of day (c) the screen width (d) the page title
-
11.✍️ What value is given to width in this rule?
p {
color: red;
width: 300px;
} (a) italic (b) red (c) width (d) 300px - 12.✍️ How does a CSS comment start? (a) // (b) /* (c) # (d) <!--
-
13.✍️ How many declarations (property: value pairs) are in this rule?
li {
border: 2px solid;
} -
14.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 190px;
justify-content: space-between;
}
Inside are 2 boxes, each 80px wide (no margins). -
15.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 180px;
padding: 10px;
border: 1px solid black;
margin: 5px;
} -
16.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 200px;
justify-content: flex-end;
}
Inside are 2 boxes, each 80px wide (no margins). - 17.🎯 Which element does the selector li style? (a) <p id="main"> (b) <span class="note"> (c) <li class="note"> (d) <div>
-
18.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (min-width: 480px) {
p {
font-size: 28px;
}
} - 19.💪 Which flexbox property picks row or column? (a) align-items (b) flex-direction (c) gap (d) display: flex
-
20.🖌️ What colour is behind the letters?
h2 {
text-align: right;
background-color: green;
font-size: 20px;
color: yellow;
} (a) white (b) green (c) yellow -
21.🎯 Which CSS selector matches this element?
<span class="big" id="logo">Hello</span> (a) .red (b) #end (c) #logo (d) .logo -
22.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 160px;
justify-content: flex-end;
}
Inside are 2 boxes, each 50px wide (no margins). -
23.📱 The screen is 700px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 600px) {
p {
font-size: 10px;
}
} (a) Yes (b) No - 24.🌈 Which colour of light is strongest in rgb(154, 93, 51)? (a) green (b) red (c) blue
- 25.🔍 Which is the odd one out? (a) makes a link (b) sets colours and fonts (c) puts a picture on a page (d) makes headings and lists
-
26.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 480px) {
p {
font-size: 8px;
}
} - 27.🌈 Which colour of light is strongest in rgb(90, 130, 253)? (a) red (b) green (c) blue
- 28.What does font-size do? (a) makes letters bigger (b) makes the text bold (c) picks the font style (d) centres a heading
- 29.What does font-family do? (a) sets the letter colour (b) centres a heading (c) makes letters bigger (d) picks the font style
- 30.📦 In the box model, which part is space outside the border? (a) border (b) content (c) margin (d) padding
- 31.🌈 In #0000a5 the blue part is the hex number a5. What is it as a normal number?
-
32.⚖️ What colour is the text of this element?
<h1 class="note" id="intro">Hi</h1>
CSS:
.note { color: blue; }
h1 { color: orange; }
#intro { color: yellow; } (a) blue (b) orange (c) yellow (d) purple - 33.🎯 Which element does the selector #main style? (a) <li id="logo"> (b) <div class="red"> (c) <li class="main"> (d) <li id="main">
- 34.💪 Which justify-content value equal gaps, none at ends? (a) center (b) flex-start (c) space-between (d) flex-end
- 35.🎯 What kind of selector is .big? (a) an id selector (b) a class selector (c) an element selector
-
36.🎯 Which CSS selector matches this element?
<h2 class="big" id="main">Hello</h2> (a) .main (b) li (c) h2 (d) #logo -
37.⚖️ What colour is the text of this element?
<p class="big" id="end">Hi</p>
CSS:
.big { color: white; }
.big { color: yellow; } (a) white (b) yellow (c) red (d) black - 38.💪 Which justify-content value packs boxes at the end? (a) flex-end (b) space-between (c) flex-start (d) center
-
39.⚖️ What colour is the text of this element?
<p class="note" id="end">Hi</p>
CSS:
p { color: purple; }
#end { color: orange; } (a) red (b) orange (c) purple (d) green - 40.True or false: margin is the gap to other boxes. (a) False (b) True
Answer key
- orange
- an element selector
- HTML
- an id selector
- 40
- green
- <link>
- CSS
- :
- the screen width
- 300px
- /*
- 1
- 30
- 212
- 40
- <li class="note">
- 20
- flex-direction
- green
- #logo
- 60
- No
- red
- sets colours and fonts
- 12
- blue
- makes letters bigger
- picks the font style
- margin
- 165
- yellow
- <li id="main">
- space-between
- a class selector
- h2
- yellow
- flex-end
- orange
- True
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids