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 element does the selector h2 style? (a) <h2 class="big"> (b) <span id="hero"> (c) <li> (d) <div class="big">
- 2.Which of these does HTML do? (a) counts down a timer (b) makes a form box (c) changes the page live (d) lays out the page
- 3.🌈 Which colour is #00ff00? (a) blue (b) bright green (c) white (d) magenta
- 4.📱 Responsive design means a page ___. (a) has no pictures (b) fits every screen (c) is only for laptops (d) never changes
- 5.🖌️ Which CSS property colours behind the text? (a) text-align (b) color (c) font-size (d) background-color
- 6.True or false: HTML changes the text size. (a) False (b) True
- 7.What does background-color do? (a) picks the font style (b) colours behind the text (c) sets the letter colour (d) makes the text bold
- 8.🎨 Which tag connects an outside CSS file? (a) <img> (b) <link> (c) <css> (d) <a>
- 9.📦 In the box model, which part is the gap to other boxes? (a) margin (b) padding (c) content (d) border
-
10.⚖️ What colour is the text of this element?
<p class="note" id="top">Hi</p>
CSS:
.note { color: white; }
p { color: yellow; }
#top { color: purple; } (a) blue (b) purple (c) yellow (d) white - 11.🖌️ Which CSS property centres a heading? (a) text-align (b) font-weight (c) font-family (d) color
- 12.📦 In the box model, which part is the line round the box? (a) border (b) margin (c) content (d) padding
- 13.Which of these is margin? (a) the line round the box (b) the gap to other boxes (c) a solid or dotted edge (d) space inside the border
- 14.✍️ Which sign ends each CSS declaration? (a) , (b) : (c) ; (d) .
-
15.✍️ How many declarations (property: value pairs) are in this rule?
h2 {
padding: 8px;
font-size: 20px;
color: red;
margin: 10px;
} - 16.🔍 Which is the odd one out? (a) makes a form box (b) makes headings and lists (c) puts a picture on a page (d) reacts to a button click
-
17.✍️ What is the selector in this CSS rule?
#top {
font-size: 20px;
font-style: italic;
border: 2px solid;
} (a) font-size (b) li (c) italic (d) #top -
18.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 220px;
justify-content: space-between;
}
Inside are 2 boxes, each 100px wide (no margins). -
19.✍️ Which property is set to yellow in this rule?
h1 {
margin: 10px;
font-size: 20px;
padding: 8px;
background-color: yellow;
} (a) background-color (b) yellow (c) margin (d) padding - 20.⚖️ Which selector is the weakest? (a) an element selector (b) a class selector (c) an id selector
-
21.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 170px;
justify-content: space-between;
}
Inside are 2 boxes, each 60px wide (no margins). - 22.True or false: CSS changes the text size. (a) True (b) False
- 23.True or false: p is an element selector. (a) False (b) True
- 24.What does font-weight do? (a) makes letters bigger (b) makes the text bold (c) picks the font style (d) colours behind the text
- 25.🎯 Which element does the selector #intro style? (a) <span id="main"> (b) <p class="box"> (c) <span id="intro"> (d) <span class="intro">
- 26.🎯 What kind of selector is .note? (a) an element selector (b) a class selector (c) an id selector
- 27.🎯 Can many elements share the same class? (a) No (b) Yes
- 28.💪 Which justify-content value packs boxes at the end? (a) center (b) flex-start (c) space-between (d) flex-end
-
29.🎯 Which CSS selector matches this element?
<span class="menu" id="top">Hello</span> (a) .note (b) #top (c) #intro (d) #menu - 30.🌈 Which colour is rgb(0, 255, 0)? (a) white (b) yellow (c) black (d) bright green
-
31.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 600px) {
p {
font-size: 18px;
}
} - 32.🎯 How many elements on a page should have the same id? (a) 5 (b) 2 (c) any number (d) 1
- 33.Which of these does JavaScript do? (a) makes headings and lists (b) gives the page structure (c) adds space around boxes (d) checks a quiz answer
- 34.True or false: .card is an element selector. (a) True (b) False
- 35.💪 Which flexbox property picks row or column? (a) gap (b) display: flex (c) align-items (d) flex-direction
- 36.🌈 Which colour is #0000ff? (a) yellow (b) blue (c) cyan (d) white
- 37.✍️ In color: blue; which part is the property? (a) blue (b) color (c) ; (d) :
-
38.⚖️ What colour is the text of this element?
<p class="big" id="end">Hi</p>
CSS:
p { color: green; }
#end { color: yellow; }
.big { color: white; } (a) yellow (b) green (c) orange (d) white -
39.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 80px;
padding: 25px;
border: 5px solid black;
margin: 5px;
} -
40.⚖️ What colour is the text of this element?
<h1 class="red" id="logo">Hi</h1>
CSS:
#logo { color: red; }
#logo { color: orange; } (a) green (b) purple (c) red (d) orange
Answer key
- <h2 class="big">
- makes a form box
- bright green
- fits every screen
- background-color
- False
- colours behind the text
- <link>
- margin
- purple
- text-align
- border
- the gap to other boxes
- ;
- 4
- reacts to a button click
- #top
- 20
- background-color
- an element selector
- 50
- True
- True
- makes the text bold
- <span id="intro">
- a class selector
- Yes
- flex-end
- #top
- bright green
- 16
- 1
- checks a quiz answer
- False
- flex-direction
- blue
- color
- yellow
- 150
- orange
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids