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.True or false: CSS lays out the page. (a) True (b) False
- 2.💪 Which flexbox property spaces boxes along a row? (a) flex-direction (b) justify-content (c) align-items (d) display: flex
- 3.True or false: JavaScript makes headings and lists. (a) True (b) False
- 4.🎯 What kind of selector is #main? (a) an id selector (b) a class selector (c) an element selector
-
5.🖌️ How big is the text, in px?
h1 {
font-size: 20px;
background-color: red;
text-align: center;
color: purple;
} - 6.📱 Which tag helps phones show a page at the right size? (a) the br tag (b) the viewport meta tag (c) the hr tag (d) the title tag
-
7.⚖️ What colour is the text of this element?
<p class="menu" id="hero">Hi</p>
CSS:
#hero { color: orange; }
#hero { color: purple; } (a) purple (b) orange (c) white (d) red - 8.🎯 Which sign starts an id selector? (a) @ (b) . (c) & (d) #
-
9.🖌️ What colour are the letters?
h1 {
color: red;
background-color: purple;
text-align: left;
font-size: 12px;
} (a) purple (b) yellow (c) red - 10.🌈 Which hex code is magenta? (a) #ff00ff (b) #00ffff (c) #ffffff (d) #00ff00
- 11.🎯 Which sign starts a class selector? (a) & (b) . (c) @ (d) #
-
12.✍️ Which property is set to 2px solid in this rule?
body {
background-color: yellow;
border: 2px solid;
} (a) font-style (b) border (c) 2px solid (d) width -
13.🖌️ How big is the text, in px?
h1 {
text-align: left;
background-color: green;
color: blue;
font-size: 20px;
} - 14.🖌️ Which CSS property makes the text bold? (a) background-color (b) font-family (c) font-weight (d) color
- 15.⚖️ Which selector is the strongest? (a) an element selector (b) an id selector (c) a class selector
-
16.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 240px;
justify-content: center;
}
Inside are 2 boxes, each 100px wide (no margins). - 17.🔍 Which is the odd one out? (a) changes the text size (b) rounds box corners (c) shows a pop-up message (d) adds space around boxes
- 18.What does font-size do? (a) centres a heading (b) makes letters bigger (c) picks the font style (d) colours behind the text
- 19.What does justify-content: flex-start do? (a) packs boxes at the end (b) equal gaps, none at ends (c) puts boxes in the middle (d) packs boxes at the start
-
20.🖌️ How big is the text, in px?
h1 {
color: red;
background-color: purple;
text-align: right;
font-size: 40px;
} -
21.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 190px;
padding: 20px;
border: 1px solid black;
margin: 10px;
} -
22.🎯 Which CSS selector matches this element?
<div class="note" id="intro">Hello</div> (a) #main (b) span (c) .intro (d) #intro - 23.🌈 In #00f600 the green part is the hex number f6. What is it as a normal number?
- 24.🌈 Which colour of light is strongest in rgb(21, 201, 45)? (a) green (b) blue (c) red
- 25.🧩 Which language changes the text size? (a) JavaScript (b) HTML (c) CSS
- 26.🧩 Which language sets colours and fonts? (a) JavaScript (b) CSS (c) HTML
-
27.✍️ Which property is set to 2px solid in this rule?
li {
border: 2px solid;
color: red;
margin: 10px;
} (a) border (b) width (c) font-style (d) 2px solid -
28.⚖️ What colour is the text of this element?
<p class="note" id="main">Hi</p>
CSS:
p { color: yellow; }
.note { color: red; }
#main { color: purple; } (a) yellow (b) purple (c) red (d) white -
29.🖌️ What colour are the letters?
p {
color: green;
font-size: 36px;
text-align: left;
background-color: purple;
} (a) green (b) purple (c) black - 30.🎯 Which element does the selector .note style? (a) <p id="note"> (b) <h1 class="red"> (c) <p class="big"> (d) <p class="note">
- 31.🎨 What does CSS stand for? (a) Cascading Style Sheets (b) Creative Sheet System (c) Colourful Site Styles (d) Computer Style Sheets
-
32.📱 The screen is 700px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (max-width: 480px) {
p {
font-size: 16px;
}
} (a) Yes (b) No - 33.What does justify-content: flex-end do? (a) puts boxes in the middle (b) packs boxes at the start (c) packs boxes at the end (d) equal gaps, none at ends
-
34.✍️ Which property is set to italic in this rule?
h1 {
color: red;
font-style: italic;
} (a) font-style (b) font-size (c) color (d) italic - 35.🌈 Which colour is rgb(255, 255, 255)? (a) red (b) white (c) blue (d) yellow
- 36.🎨 One CSS file can style how many pages? (a) many pages (b) only one image (c) no pages (d) only one word
-
37.⚖️ What colour is the text of this element?
<p class="star" id="main">Hi</p>
CSS:
.star { color: green; }
p { color: blue; }
#main { color: white; } (a) green (b) white (c) orange (d) blue - 38.🧩 Which language puts a picture on a page? (a) CSS (b) HTML (c) JavaScript
- 39.🌈 Which colour of light is strongest in rgb(199, 139, 6)? (a) blue (b) red (c) green
-
40.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (max-width: 768px) {
p {
font-size: 14px;
}
} (a) No (b) Yes
Answer key
- True
- justify-content
- False
- an id selector
- 20
- the viewport meta tag
- purple
- #
- red
- #ff00ff
- .
- border
- 20
- font-weight
- an id selector
- 20
- shows a pop-up message
- makes letters bigger
- packs boxes at the start
- 40
- 232
- #intro
- 246
- green
- CSS
- CSS
- border
- purple
- green
- <p class="note">
- Cascading Style Sheets
- No
- packs boxes at the end
- font-style
- white
- many pages
- white
- HTML
- red
- Yes
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids