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 sets the letter colour? (a) font-weight (b) color (c) background-color (d) text-align
- 2.🔍 Which is the odd one out? (a) sets colours and fonts (b) adds space around boxes (c) shows a pop-up message (d) lays out the page
-
3.✍️ What is the selector in this CSS rule?
li {
font-style: italic;
margin: 10px;
} (a) body (b) li (c) 10px (d) font-style - 4.🌈 Which colour of light is strongest in rgb(240, 92, 73)? (a) green (b) red (c) blue
-
5.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 120px;
padding: 15px;
border: 2px solid black;
margin: 15px;
} -
6.📱 The screen is 1366px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (min-width: 480px) {
p {
font-size: 16px;
}
} (a) No (b) Yes - 7.What does justify-content: flex-start do? (a) equal gaps, none at ends (b) packs boxes at the end (c) packs boxes at the start (d) puts boxes in the middle
-
8.📱 The screen is 700px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (min-width: 1024px) {
p {
font-size: 16px;
}
} (a) Yes (b) No - 9.🎯 Which sign starts an id selector? (a) & (b) # (c) @ (d) .
-
10.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 768px) {
p {
font-size: 6px;
}
} - 11.🎯 Which element does the selector #end style? (a) <h2 id="end"> (b) <h2 id="hero"> (c) <li class="big"> (d) <h2 class="end">
- 12.🎯 Which element does the selector .menu style? (a) <li class="menu"> (b) <li class="note"> (c) <div class="big"> (d) <li id="menu">
- 13.🎯 What kind of selector is .star? (a) an element selector (b) a class selector (c) an id selector
- 14.🔍 Which is the odd one out? (a) lays out the page (b) sets colours and fonts (c) changes the text size (d) puts a picture on a page
-
15.✍️ What is the selector in this CSS rule?
.note {
text-align: center;
color: red;
font-weight: bold;
} (a) #top (b) text-align (c) .note (d) red - 16.🎯 How many elements on a page should have the same id? (a) 1 (b) 5 (c) 2 (d) any number
- 17.💪 Which flexbox property turns on flexbox? (a) align-items (b) justify-content (c) flex-direction (d) display: flex
- 18.True or false: HTML reacts to a button click. (a) True (b) False
- 19.📱 What does a media query check? (a) the page title (b) the time of day (c) the screen width (d) the battery level
-
20.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 460px;
justify-content: flex-end;
}
Inside are 4 boxes, each 100px wide (no margins). -
21.🖌️ What colour are the letters?
p {
background-color: orange;
color: red;
text-align: left;
font-size: 28px;
} (a) red (b) black (c) orange -
22.🎯 Which CSS selector matches this element?
<span class="star" id="top">Hello</span> (a) #star (b) .menu (c) .top (d) span - 23.Which of these does CSS do? (a) sets colours and fonts (b) counts down a timer (c) checks a quiz answer (d) makes a form box
-
24.✍️ Which property is set to 8px in this rule?
h1 {
font-weight: bold;
padding: 8px;
color: red;
} (a) font-weight (b) 8px (c) border (d) padding - 25.✍️ CSS declarations go inside which brackets? (a) < > (b) ( ) (c) [ ] (d) { }
- 26.🎯 Which element does the selector #logo style? (a) <h2 class="red"> (b) <h1 id="logo"> (c) <h1 class="logo"> (d) <h1 id="end">
- 27.🎨 A CSS file usually ends with which extension? (a) .js (b) .png (c) .css (d) .html
-
28.⚖️ What colour is the text of this element?
<h1 class="menu" id="intro">Hi</h1>
CSS:
h1 { color: green; }
#intro { color: red; } (a) red (b) purple (c) green (d) black - 29.Which of these does CSS do? (a) gives the page structure (b) changes the page live (c) checks a quiz answer (d) lays out the page
-
30.✍️ How many declarations (property: value pairs) are in this rule?
body {
text-align: center;
font-style: italic;
} -
31.✍️ What value is given to margin in this rule?
body {
margin: 10px;
width: 300px;
text-align: center;
} (a) 8px (b) margin (c) 10px (d) bold - 32.💪 Which flexbox property lines boxes up across? (a) display: flex (b) gap (c) flex-direction (d) align-items
-
33.✍️ How many declarations (property: value pairs) are in this rule?
li {
color: red;
text-align: center;
width: 300px;
} -
34.✍️ Which property is set to 2px solid in this rule?
.box {
background-color: yellow;
width: 300px;
text-align: center;
border: 2px solid;
} (a) border (b) font-style (c) width (d) 2px solid - 35.True or false: JavaScript changes the text size. (a) True (b) False
-
36.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 50px;
padding: 5px;
border: 4px solid black;
margin: 5px;
} - 37.🌈 What is the biggest number one colour can have in rgb()? (a) 100 (b) 99 (c) 255 (d) 1000
- 38.🌈 Which colour of light is strongest in rgb(58, 251, 114)? (a) blue (b) green (c) red
-
39.🖌️ What colour is behind the letters?
p {
background-color: purple;
color: yellow;
font-size: 16px;
text-align: center;
} (a) yellow (b) white (c) purple - 40.🌈 Which colour is rgb(255, 255, 0)? (a) yellow (b) red (c) magenta (d) black
Answer key
- color
- shows a pop-up message
- li
- red
- 184
- Yes
- packs boxes at the start
- No
- #
- 6
- <h2 id="end">
- <li class="menu">
- a class selector
- puts a picture on a page
- .note
- 1
- display: flex
- False
- the screen width
- 60
- red
- span
- sets colours and fonts
- padding
- { }
- <h1 id="logo">
- .css
- red
- lays out the page
- 2
- 10px
- align-items
- 3
- border
- False
- 78
- 255
- green
- purple
- yellow
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids