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.🎨 What does CSS stand for? (a) Creative Sheet System (b) Cascading Style Sheets (c) Colourful Site Styles (d) Computer Style Sheets
- 2.🧩 Which language shows a pop-up message? (a) CSS (b) JavaScript (c) HTML
- 3.🔍 Which is the odd one out? (a) gives the page structure (b) lays out the page (c) sets colours and fonts (d) changes the text size
-
4.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (max-width: 768px) {
p {
font-size: 20px;
}
} - 5.Which of these does JavaScript do? (a) shows a pop-up message (b) lays out the page (c) sets colours and fonts (d) adds space around boxes
- 6.🔍 Which is the odd one out? (a) shows a pop-up message (b) counts down a timer (c) checks a quiz answer (d) makes a form box
- 7.What does justify-content: center do? (a) puts boxes in the middle (b) packs boxes at the end (c) equal gaps, none at ends (d) packs boxes at the start
-
8.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (max-width: 768px) {
p {
font-size: 18px;
}
} - 9.🎯 Which element does the selector #hero style? (a) <span id="top"> (b) <span id="hero"> (c) <p class="menu"> (d) <span class="hero">
-
10.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 260px;
padding: 10px;
border: 4px solid black;
margin: 15px;
} - 11.True or false: padding is space outside the border. (a) True (b) False
-
12.⚖️ What colour is the text of this element?
<h1 class="big" id="top">Hi</h1>
CSS:
h1 { color: blue; }
#top { color: green; }
.big { color: black; } (a) red (b) black (c) green (d) blue - 13.🌈 Which colour of light is strongest in rgb(249, 50, 66)? (a) green (b) blue (c) red
- 14.Which of these does HTML do? (a) reacts to a button click (b) puts a picture on a page (c) checks a quiz answer (d) counts down a timer
-
15.🎯 Which CSS selector matches this element?
<li class="red" id="top">Hello</li> (a) #red (b) .box (c) li (d) #intro - 16.🎯 Which element does the selector .note style? (a) <h1 id="note"> (b) <h2 class="red"> (c) <h1 class="note"> (d) <h1 class="big">
- 17.🎯 What kind of selector is img? (a) a class selector (b) an id selector (c) an element selector
- 18.True or false: JavaScript adds space around boxes. (a) True (b) False
- 19.📱 min-width: 800px applies when the screen is ___. (a) turned off (b) exactly 100px (c) 800px or wider (d) 800px or narrower
-
20.🖌️ Where does the text sit on its line?
h2 {
background-color: green;
color: yellow;
text-align: left;
font-size: 16px;
} (a) on the left (b) in the middle (c) on the right - 21.💪 Which flexbox property sets space between boxes? (a) gap (b) flex-direction (c) justify-content (d) display: flex
-
22.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 280px;
padding: 10px;
border: 5px solid black;
margin: 15px;
} -
23.🖌️ How big is the text, in px?
p {
color: yellow;
background-color: green;
font-size: 32px;
text-align: left;
} - 24.💪 Which justify-content value puts boxes in the middle? (a) flex-end (b) space-between (c) center (d) flex-start
-
25.🎯 Which CSS selector matches this element?
<span class="star" id="logo">Hello</span> (a) .menu (b) #logo (c) .logo (d) #end - 26.🎯 Which element does the selector #main style? (a) <p class="main"> (b) <p id="logo"> (c) <h1 class="menu"> (d) <p id="main">
-
27.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 600px) {
p {
font-size: 16px;
}
} -
28.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 120px;
justify-content: space-between;
}
Inside are 2 boxes, each 50px wide (no margins). - 29.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the later one (b) neither (c) the first one (d) the shorter one
- 30.💪 Which flexbox property picks row or column? (a) align-items (b) display: flex (c) flex-direction (d) justify-content
- 31.🎯 What kind of selector is #end? (a) a class selector (b) an id selector (c) an element selector
- 32.🌈 Which colour is #ffffff? (a) white (b) bright green (c) blue (d) magenta
- 33.What does justify-content: flex-start do? (a) equal gaps, none at ends (b) puts boxes in the middle (c) packs boxes at the end (d) packs boxes at the start
- 34.⚖️ Which selector is the weakest? (a) a class selector (b) an element selector (c) an id selector
-
35.🎯 Which CSS selector matches this element?
<span class="star" id="intro">Hello</span> (a) #star (b) #intro (c) #main (d) p - 36.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 2 (b) 3 (c) 6 (d) 4
- 37.🧩 Which language checks a quiz answer? (a) HTML (b) JavaScript (c) CSS
-
38.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 600px) {
p {
font-size: 10px;
}
} - 39.🌈 Which colour is rgb(255, 255, 0)? (a) cyan (b) white (c) yellow (d) bright green
-
40.🎯 Which CSS selector matches this element?
<span class="note" id="main">Hello</span> (a) #logo (b) span (c) p (d) .main
Answer key
- Cascading Style Sheets
- JavaScript
- gives the page structure
- 20
- shows a pop-up message
- makes a form box
- puts boxes in the middle
- 18
- <span id="hero">
- 288
- False
- green
- red
- puts a picture on a page
- li
- <h1 class="note">
- an element selector
- False
- 800px or wider
- on the left
- gap
- 310
- 32
- center
- #logo
- <p id="main">
- 16
- 20
- the later one
- flex-direction
- an id selector
- white
- packs boxes at the start
- an element selector
- #intro
- 3
- JavaScript
- 10
- yellow
- span
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids