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.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 380px;
justify-content: space-between;
}
Inside are 4 boxes, each 80px wide (no margins). -
2.⚖️ What colour is the text of this element?
<h1 class="big" id="logo">Hi</h1>
CSS:
h1 { color: purple; }
#logo { color: orange; }
.big { color: white; } (a) white (b) black (c) orange (d) purple - 3.True or false: CSS counts down a timer. (a) False (b) True
- 4.🌈 Which colour is #0000ff? (a) red (b) blue (c) magenta (d) white
-
5.✍️ What is the selector in this CSS rule?
body {
font-size: 20px;
background-color: yellow;
} (a) yellow (b) .box (c) font-size (d) body - 6.🔍 Which is the odd one out? (a) rounds box corners (b) makes headings and lists (c) gives the page structure (d) puts a picture on a page
-
7.⚖️ What colour is the text of this element?
<p class="note" id="top">Hi</p>
CSS:
p { color: orange; }
p { color: yellow; } (a) yellow (b) green (c) blue (d) orange - 8.🧩 Which language changes the page live? (a) CSS (b) HTML (c) JavaScript
- 9.💪 Which justify-content value puts boxes in the middle? (a) space-between (b) flex-start (c) flex-end (d) center
- 10.What does justify-content: flex-end do? (a) puts boxes in the middle (b) equal gaps, none at ends (c) packs boxes at the start (d) packs boxes at the end
- 11.🔍 Which is the odd one out? (a) checks a quiz answer (b) puts a picture on a page (c) counts down a timer (d) changes the page live
- 12.🌈 Which colour is #ff0000? (a) bright green (b) cyan (c) red (d) blue
-
13.🖌️ What colour are the letters?
li {
background-color: orange;
font-size: 12px;
color: black;
text-align: right;
} (a) orange (b) blue (c) black - 14.✍️ Which sign ends each CSS declaration? (a) , (b) ; (c) : (d) .
- 15.📱 What does a media query check? (a) the time of day (b) the battery level (c) the page title (d) the screen width
- 16.🎯 What kind of selector is .big? (a) a class selector (b) an id selector (c) an element selector
- 17.⚖️ Which selector is the weakest? (a) an element selector (b) an id selector (c) a class selector
- 18.📦 In the box model, which part is space inside the border? (a) padding (b) border (c) margin (d) content
- 19.🎯 Which element does the selector #end style? (a) <h2 id="end"> (b) <h2 class="end"> (c) <li class="big"> (d) <h2 id="hero">
- 20.📦 In the box model, which part is space outside the border? (a) padding (b) content (c) border (d) margin
- 21.True or false: #hero is a class selector. (a) False (b) True
-
22.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 100px;
padding: 10px;
border: 5px solid black;
margin: 10px;
} - 23.True or false: JavaScript adds space around boxes. (a) True (b) False
- 24.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 6 (b) 4 (c) 3 (d) 2
-
25.⚖️ What colour is the text of this element?
<p class="box" id="hero">Hi</p>
CSS:
.box { color: white; }
.box { color: black; } (a) blue (b) black (c) white (d) purple - 26.💪 Which flexbox property lines boxes up across? (a) display: flex (b) flex-direction (c) justify-content (d) align-items
-
27.✍️ How many declarations (property: value pairs) are in this rule?
body {
margin: 10px;
border: 2px solid;
} - 28.🎯 Can many elements share the same class? (a) No (b) Yes
- 29.🎯 Which element does the selector .box style? (a) <h2 class="box"> (b) <h2 class="star"> (c) <li class="menu"> (d) <h2 id="box">
- 30.🎯 What kind of selector is .note? (a) a class selector (b) an element selector (c) an id selector
- 31.🎯 Which element does the selector .box style? (a) <h1 class="menu"> (b) <p class="star"> (c) <p class="box"> (d) <p id="box">
- 32.🔍 Which is the odd one out? (a) makes headings and lists (b) lays out the page (c) sets colours and fonts (d) changes the text size
-
33.🖌️ What colour is behind the letters?
h2 {
text-align: center;
color: purple;
background-color: green;
font-size: 12px;
} (a) purple (b) red (c) green -
34.🖌️ Where does the text sit on its line?
h1 {
background-color: yellow;
font-size: 16px;
text-align: right;
color: black;
} (a) on the left (b) in the middle (c) on the right - 35.✍️ CSS declarations go inside which brackets? (a) { } (b) ( ) (c) [ ] (d) < >
- 36.🌈 Hex digits go 0 to 9, then A to which letter? (a) Z (b) F (c) J (d) G
-
37.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 200px;
justify-content: center;
}
Inside are 3 boxes, each 40px wide (no margins). - 38.🔍 Which is the odd one out? (a) changes the page live (b) adds space around boxes (c) counts down a timer (d) checks a quiz answer
-
39.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 500px;
justify-content: space-between;
}
Inside are 4 boxes, each 80px wide (no margins). -
40.✍️ Which property is set to 20px in this rule?
h2 {
background-color: yellow;
font-size: 20px;
} (a) background-color (b) 20px (c) text-align (d) font-size
Answer key
- 20
- orange
- False
- blue
- body
- rounds box corners
- yellow
- JavaScript
- center
- packs boxes at the end
- puts a picture on a page
- red
- black
- ;
- the screen width
- a class selector
- an element selector
- padding
- <h2 id="end">
- margin
- False
- 150
- False
- 3
- black
- align-items
- 2
- Yes
- <h2 class="box">
- a class selector
- <p class="box">
- makes headings and lists
- green
- on the right
- { }
- F
- 40
- adds space around boxes
- 60
- font-size
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids