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 is the odd one out? (a) checks a quiz answer (b) reacts to a button click (c) changes the text size (d) counts down a timer
-
2.🖌️ What colour is behind the letters?
h2 {
background-color: blue;
color: orange;
text-align: left;
font-size: 12px;
} (a) orange (b) red (c) blue -
3.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 200px;
padding: 30px;
border: 2px solid black;
margin: 15px;
} -
4.✍️ What is the selector in this CSS rule?
.note {
text-align: center;
color: red;
margin: 10px;
width: 300px;
} (a) red (b) .note (c) #top (d) text-align - 5.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the first one (c) the later one (d) the shorter one
- 6.🌈 Which colour of light is strongest in rgb(171, 71, 33)? (a) blue (b) red (c) green
- 7.🎯 Which element does the selector li style? (a) <span class="big"> (b) <div> (c) <li class="big"> (d) <p id="hero">
- 8.🎯 Which sign starts a class selector? (a) # (b) @ (c) & (d) .
-
9.🎯 Which CSS selector matches this element?
<p class="note" id="top">Hello</p> (a) #note (b) #intro (c) #top (d) .big - 10.🎯 Which element does the selector div style? (a) <span> (b) <div class="note"> (c) <p class="note"> (d) <h1 id="hero">
- 11.📱 max-width: 600px applies when the screen is ___. (a) turned off (b) 600px or narrower (c) 600px or wider (d) exactly 1000px
-
12.🖌️ What colour is behind the letters?
p {
text-align: right;
font-size: 16px;
color: black;
background-color: white;
} (a) green (b) black (c) white - 13.🎨 What does CSS stand for? (a) Creative Sheet System (b) Computer Style Sheets (c) Colourful Site Styles (d) Cascading Style Sheets
- 14.🧩 Which language makes a form box? (a) CSS (b) HTML (c) JavaScript
-
15.⚖️ What colour is the text of this element?
<h2 class="note" id="top">Hi</h2>
CSS:
h2 { color: purple; }
h2 { color: blue; } (a) blue (b) orange (c) black (d) purple - 16.True or false: .note is an id selector. (a) False (b) True
-
17.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (min-width: 600px) {
p {
font-size: 28px;
}
} - 18.Which of these is padding? (a) the line round the box (b) space inside the border (c) the gap to other boxes (d) the text or picture
- 19.🌈 Which colour is #ffffff? (a) bright green (b) red (c) yellow (d) white
-
20.🖌️ How big is the text, in px?
p {
text-align: left;
color: purple;
background-color: orange;
font-size: 32px;
} - 21.🖌️ Which CSS property colours behind the text? (a) text-align (b) font-weight (c) color (d) background-color
- 22.True or false: #hero is a class selector. (a) True (b) False
- 23.📦 In the box model, which part is the line round the box? (a) margin (b) content (c) padding (d) border
- 24.Which of these does JavaScript do? (a) puts a picture on a page (b) rounds box corners (c) reacts to a button click (d) adds space around boxes
-
25.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 50px;
padding: 10px;
border: 2px solid black;
margin: 5px;
} - 26.Which of these is the content? (a) the gap round content (b) the line round the box (c) the text or picture (d) space inside the border
-
27.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 120px;
justify-content: flex-end;
}
Inside are 2 boxes, each 40px wide (no margins). -
28.🖌️ What colour is behind the letters?
p {
font-size: 36px;
color: white;
background-color: yellow;
text-align: center;
} (a) yellow (b) blue (c) white - 29.🧩 Which language gives the page structure? (a) CSS (b) HTML (c) JavaScript
- 30.🖌️ Which CSS property centres a heading? (a) text-align (b) font-family (c) background-color (d) font-weight
- 31.🔍 Which is the odd one out? (a) rounds box corners (b) makes a form box (c) makes a link (d) gives the page structure
-
32.✍️ What is the selector in this CSS rule?
li {
border: 2px solid;
text-align: center;
margin: 10px;
font-size: 20px;
} (a) center (b) li (c) body (d) border - 33.✍️ CSS declarations go inside which brackets? (a) [ ] (b) < > (c) { } (d) ( )
-
34.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 170px;
padding: 30px;
border: 1px solid black;
margin: 5px;
} -
35.🖌️ What colour is behind the letters?
p {
color: black;
text-align: center;
background-color: purple;
font-size: 32px;
} (a) blue (b) black (c) purple - 36.🎯 Which element does the selector .red style? (a) <p id="red"> (b) <p class="box"> (c) <h1 class="star"> (d) <p class="red">
-
37.⚖️ What colour is the text of this element?
<h1 class="menu" id="logo">Hi</h1>
CSS:
h1 { color: yellow; }
.menu { color: orange; } (a) yellow (b) orange (c) blue (d) black - 38.🎯 What kind of selector is .note? (a) a class selector (b) an element selector (c) an id selector
-
39.✍️ What is the selector in this CSS rule?
body {
text-align: center;
width: 300px;
padding: 8px;
border: 2px solid;
} (a) 300px (b) body (c) .box (d) text-align -
40.✍️ How many declarations (property: value pairs) are in this rule?
p {
color: red;
}
Answer key
- changes the text size
- blue
- 294
- .note
- the later one
- red
- <li class="big">
- .
- #top
- <div class="note">
- 600px or narrower
- white
- Cascading Style Sheets
- HTML
- blue
- False
- 28
- space inside the border
- white
- 32
- background-color
- False
- border
- reacts to a button click
- 84
- the text or picture
- 40
- yellow
- HTML
- text-align
- rounds box corners
- li
- { }
- 242
- purple
- <p class="red">
- orange
- a class selector
- body
- 1
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids