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 CSS property colours behind the text? (a) font-size (b) background-color (c) color (d) font-family
- 2.What does justify-content: center do? (a) packs boxes at the start (b) puts boxes in the middle (c) packs boxes at the end (d) equal gaps, none at ends
- 3.🔍 Which is the odd one out? (a) puts a picture on a page (b) sets colours and fonts (c) gives the page structure (d) makes a form box
-
4.🖌️ What colour is behind the letters?
h1 {
color: white;
background-color: red;
text-align: center;
font-size: 12px;
} (a) yellow (b) red (c) white -
5.⚖️ What colour is the text of this element?
<h1 class="red" id="top">Hi</h1>
CSS:
.red { color: orange; }
.red { color: green; } (a) green (b) red (c) orange (d) blue - 6.💪 Which flexbox property picks row or column? (a) display: flex (b) justify-content (c) align-items (d) flex-direction
- 7.🎨 A CSS file usually ends with which extension? (a) .png (b) .html (c) .js (d) .css
- 8.🧩 Which language gives the page structure? (a) HTML (b) CSS (c) JavaScript
- 9.What does justify-content: flex-start do? (a) puts boxes in the middle (b) packs boxes at the start (c) equal gaps, none at ends (d) packs boxes at the end
- 10.🌈 Which hex code is cyan? (a) #00ffff (b) #00ff00 (c) #ff0000 (d) #ff00ff
-
11.✍️ What value is given to width in this rule?
.note {
font-weight: bold;
padding: 8px;
width: 300px;
} (a) italic (b) red (c) 300px (d) width -
12.✍️ How many declarations (property: value pairs) are in this rule?
.box {
font-size: 20px;
padding: 8px;
text-align: center;
} - 13.Which of these is margin? (a) the gap to other boxes (b) the gap round content (c) space inside the border (d) a solid or dotted edge
-
14.🖌️ What colour is behind the letters?
h1 {
background-color: orange;
font-size: 32px;
color: blue;
text-align: left;
} (a) blue (b) orange (c) black -
15.✍️ Which property is set to 300px in this rule?
.note {
font-style: italic;
border: 2px solid;
width: 300px;
} (a) width (b) font-style (c) 300px (d) color -
16.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 70px;
padding: 30px;
border: 1px solid black;
margin: 20px;
} - 17.📱 min-width: 800px applies when the screen is ___. (a) turned off (b) 800px or wider (c) exactly 100px (d) 800px or narrower
- 18.🌈 What is the biggest number one colour can have in rgb()? (a) 255 (b) 99 (c) 1000 (d) 100
-
19.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 220px;
justify-content: center;
}
Inside are 4 boxes, each 40px wide (no margins). - 20.📱 What does a media query check? (a) the time of day (b) the screen width (c) the page title (d) the battery level
-
21.⚖️ What colour is the text of this element?
<p class="red" id="intro">Hi</p>
CSS:
.red { color: orange; }
.red { color: blue; } (a) black (b) red (c) orange (d) blue -
22.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 480px) {
p {
font-size: 22px;
}
} -
23.🎯 Which CSS selector matches this element?
<p class="star" id="intro">Hello</p> (a) #main (b) .menu (c) .star (d) .intro - 24.🎯 Which sign starts a class selector? (a) . (b) & (c) # (d) @
-
25.⚖️ What colour is the text of this element?
<p class="box" id="intro">Hi</p>
CSS:
p { color: red; }
p { color: blue; } (a) red (b) blue (c) green (d) black - 26.Which of these does JavaScript do? (a) rounds box corners (b) makes headings and lists (c) reacts to a button click (d) sets colours and fonts
-
27.⚖️ What colour is the text of this element?
<p class="note" id="end">Hi</p>
CSS:
#end { color: green; }
p { color: purple; }
.note { color: orange; } (a) black (b) orange (c) green (d) purple - 28.🎯 Which element does the selector #top style? (a) <li class="top"> (b) <li id="top"> (c) <div class="big"> (d) <li id="intro">
-
29.⚖️ What colour is the text of this element?
<p class="star" id="intro">Hi</p>
CSS:
p { color: blue; }
.star { color: orange; } (a) red (b) blue (c) green (d) orange -
30.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 1024px) {
p {
font-size: 26px;
}
} - 31.🎯 Which element does the selector .note style? (a) <h1 class="red"> (b) <p class="big"> (c) <p class="note"> (d) <p id="note">
- 32.✍️ How does a CSS comment start? (a) <!-- (b) // (c) # (d) /*
- 33.Which of these does HTML do? (a) changes the text size (b) checks a quiz answer (c) shows a pop-up message (d) makes a form box
- 34.🌈 Which hex code is bright green? (a) #ffff00 (b) #ff00ff (c) #00ff00 (d) #00ffff
-
35.✍️ Which property is set to center in this rule?
p {
font-weight: bold;
width: 300px;
font-size: 20px;
text-align: center;
} (a) margin (b) center (c) background-color (d) text-align - 36.🌈 Which hex code is blue? (a) #0000ff (b) #000000 (c) #ff00ff (d) #ffffff
- 37.What does background-color do? (a) picks the font style (b) colours behind the text (c) makes letters bigger (d) centres a heading
- 38.🔍 Which is the odd one out? (a) gives the page structure (b) makes a link (c) lays out the page (d) makes a form box
-
39.🖌️ What colour are the letters?
p {
text-align: left;
background-color: black;
font-size: 12px;
color: yellow;
} (a) black (b) yellow (c) blue - 40.🖌️ Which CSS property makes letters bigger? (a) font-family (b) color (c) font-size (d) text-align
Answer key
- background-color
- puts boxes in the middle
- sets colours and fonts
- red
- green
- flex-direction
- .css
- HTML
- packs boxes at the start
- #00ffff
- 300px
- 3
- the gap to other boxes
- orange
- width
- 172
- 800px or wider
- 255
- 30
- the screen width
- blue
- 16
- .star
- .
- blue
- reacts to a button click
- green
- <li id="top">
- orange
- 24
- <p class="note">
- /*
- makes a form box
- #00ff00
- text-align
- #0000ff
- colours behind the text
- lays out the page
- yellow
- font-size
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids