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 big is the text, in px?
h2 {
background-color: blue;
font-size: 36px;
text-align: left;
color: black;
} - 2.🎨 Which attribute adds CSS inside one tag? (a) alt (b) src (c) href (d) style
- 3.🎯 Which element does the selector span style? (a) <span class="note"> (b) <p> (c) <h2 id="intro"> (d) <h1 class="note">
- 4.What does justify-content: center do? (a) puts boxes in the middle (b) equal gaps, none at ends (c) packs boxes at the end (d) packs boxes at the start
- 5.🌈 What is the biggest number one colour can have in rgb()? (a) 100 (b) 99 (c) 1000 (d) 255
- 6.🖌️ Which CSS property picks the font style? (a) font-size (b) font-family (c) background-color (d) text-align
-
7.🎯 Which CSS selector matches this element?
<div class="note" id="hero">Hello</div> (a) span (b) div (c) #note (d) #top -
8.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 130px;
padding: 30px;
border: 3px solid black;
margin: 20px;
} - 9.🌈 Which hex code is blue? (a) #ffff00 (b) #0000ff (c) #ffffff (d) #000000
- 10.📱 min-width: 800px applies when the screen is ___. (a) 800px or wider (b) 800px or narrower (c) exactly 100px (d) turned off
- 11.True or false: .card is an id selector. (a) True (b) False
- 12.What does font-weight do? (a) colours behind the text (b) makes letters bigger (c) makes the text bold (d) sets the letter colour
-
13.✍️ How many declarations (property: value pairs) are in this rule?
p {
text-align: center;
} - 14.💪 Which flexbox property spaces boxes along a row? (a) justify-content (b) align-items (c) display: flex (d) gap
- 15.🔍 Which is the odd one out? (a) counts down a timer (b) changes the page live (c) makes a form box (d) reacts to a button click
- 16.Which of these does CSS do? (a) makes a form box (b) puts a picture on a page (c) makes a link (d) sets colours and fonts
- 17.📱 max-width: 600px applies when the screen is ___. (a) 600px or narrower (b) exactly 1000px (c) 600px or wider (d) turned off
- 18.True or false: padding is a solid or dotted edge. (a) False (b) True
-
19.⚖️ What colour is the text of this element?
<p class="box" id="end">Hi</p>
CSS:
p { color: green; }
p { color: red; } (a) black (b) blue (c) red (d) green -
20.⚖️ What colour is the text of this element?
<p class="big" id="main">Hi</p>
CSS:
p { color: black; }
p { color: yellow; } (a) purple (b) red (c) yellow (d) black - 21.✍️ Which sign ends each CSS declaration? (a) : (b) , (c) . (d) ;
- 22.🎯 What kind of selector is .note? (a) an id selector (b) a class selector (c) an element selector
- 23.✍️ Which sign goes between a property and its value? (a) : (b) - (c) ; (d) =
- 24.🎯 Can many elements share the same class? (a) No (b) Yes
-
25.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 160px;
padding: 25px;
border: 3px solid black;
margin: 5px;
} - 26.🌈 Which colour is #0000ff? (a) black (b) blue (c) yellow (d) white
-
27.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 70px;
padding: 25px;
border: 3px solid black;
margin: 0px;
} - 28.True or false: p is an element selector. (a) True (b) False
- 29.🌈 Which colour is rgb(255, 255, 0)? (a) cyan (b) red (c) black (d) yellow
- 30.🎯 Which sign starts an id selector? (a) . (b) & (c) # (d) @
- 31.📱 Responsive design means a page ___. (a) is only for laptops (b) fits every screen (c) never changes (d) has no pictures
- 32.🧩 Which language shows a pop-up message? (a) JavaScript (b) HTML (c) CSS
- 33.🖌️ Which CSS property colours behind the text? (a) text-align (b) font-size (c) color (d) background-color
- 34.🧩 Which language makes a link? (a) CSS (b) HTML (c) JavaScript
- 35.💪 Which justify-content value equal gaps, none at ends? (a) center (b) space-between (c) flex-end (d) flex-start
- 36.🌈 In #rrggbb, which colour do the last two digits give? (a) green (b) white (c) red (d) blue
-
37.🖌️ What colour are the letters?
h2 {
background-color: yellow;
font-size: 20px;
text-align: left;
color: white;
} (a) yellow (b) green (c) white - 38.True or false: the border is the line round the box. (a) False (b) True
- 39.💪 Which justify-content value packs boxes at the end? (a) flex-start (b) flex-end (c) center (d) space-between
-
40.🖌️ What colour are the letters?
li {
color: white;
background-color: yellow;
text-align: center;
font-size: 20px;
} (a) white (b) yellow (c) black
Answer key
- 36
- style
- <span class="note">
- puts boxes in the middle
- 255
- font-family
- div
- 196
- #0000ff
- 800px or wider
- False
- makes the text bold
- 1
- justify-content
- makes a form box
- sets colours and fonts
- 600px or narrower
- False
- red
- yellow
- ;
- a class selector
- :
- Yes
- 226
- blue
- 126
- True
- yellow
- #
- fits every screen
- JavaScript
- background-color
- HTML
- space-between
- blue
- white
- True
- flex-end
- white
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids