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 justify-content value equal gaps, none at ends? (a) flex-end (b) flex-start (c) space-between (d) center
- 2.🎯 Which element does the selector .note style? (a) <span class="note"> (b) <span class="big"> (c) <span id="note"> (d) <p class="red">
- 3.🎯 Which element does the selector #main style? (a) <h2 class="star"> (b) <h1 id="logo"> (c) <h1 class="main"> (d) <h1 id="main">
- 4.🌈 Which colour is #ffff00? (a) magenta (b) black (c) bright green (d) yellow
-
5.🖌️ What colour are the letters?
li {
color: green;
font-size: 36px;
background-color: red;
text-align: left;
} (a) purple (b) red (c) green -
6.🖌️ What colour is behind the letters?
h1 {
text-align: center;
color: purple;
font-size: 36px;
background-color: black;
} (a) white (b) purple (c) black - 7.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the later one (b) the shorter one (c) the first one (d) neither
- 8.🖌️ Which CSS property sets the letter colour? (a) font-size (b) color (c) background-color (d) font-weight
- 9.🎯 Which element does the selector .big style? (a) <h1 class="box"> (b) <p class="big"> (c) <p class="red"> (d) <p id="big">
-
10.🖌️ Where does the text sit on its line?
h1 {
font-size: 12px;
color: green;
text-align: right;
background-color: black;
} (a) on the left (b) in the middle (c) on the right -
11.📱 The screen is 1100px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (min-width: 1024px) {
p {
font-size: 24px;
}
} (a) Yes (b) No - 12.📱 max-width: 600px applies when the screen is ___. (a) turned off (b) 600px or wider (c) exactly 1000px (d) 600px or narrower
- 13.✍️ Which sign ends each CSS declaration? (a) : (b) . (c) ; (d) ,
- 14.📱 min-width: 800px applies when the screen is ___. (a) 800px or wider (b) exactly 100px (c) turned off (d) 800px or narrower
-
15.⚖️ What colour is the text of this element?
<h1 class="big" id="hero">Hi</h1>
CSS:
h1 { color: green; }
h1 { color: white; } (a) yellow (b) green (c) white (d) orange - 16.🌈 Which hex code is black? (a) #ffff00 (b) #00ffff (c) #000000 (d) #00ff00
- 17.🎯 Which element does the selector #intro style? (a) <li class="intro"> (b) <li id="intro"> (c) <li id="main"> (d) <div class="star">
- 18.💪 Which flexbox property turns on flexbox? (a) flex-direction (b) display: flex (c) justify-content (d) gap
- 19.True or false: .card is an id selector. (a) True (b) False
- 20.True or false: HTML gives the page structure. (a) False (b) True
-
21.⚖️ What colour is the text of this element?
<h2 class="big" id="logo">Hi</h2>
CSS:
#logo { color: purple; }
h2 { color: green; } (a) red (b) green (c) white (d) purple -
22.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 110px;
justify-content: space-between;
}
Inside are 2 boxes, each 50px wide (no margins). -
23.⚖️ What colour is the text of this element?
<h1 class="star" id="intro">Hi</h1>
CSS:
#intro { color: white; }
#intro { color: black; } (a) red (b) white (c) purple (d) black - 24.🌈 In #rrggbb, which colour do the first two digits give? (a) black (b) blue (c) green (d) red
- 25.🖌️ Which CSS property picks the font style? (a) font-size (b) font-family (c) text-align (d) font-weight
- 26.🌈 Which colour is rgb(0, 0, 0)? (a) blue (b) black (c) cyan (d) red
- 27.True or false: margin is the line round the box. (a) True (b) False
- 28.✍️ In color: blue; which part is the value? (a) : (b) ; (c) blue (d) color
- 29.📦 In the box model, which part is the gap round content? (a) border (b) padding (c) content (d) margin
- 30.✍️ Which sign goes between a property and its value? (a) = (b) ; (c) - (d) :
- 31.🎯 Which element does the selector .box style? (a) <li class="box"> (b) <li id="box"> (c) <div class="menu"> (d) <li class="star">
-
32.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (min-width: 600px) {
p {
font-size: 20px;
}
} - 33.🎯 What kind of selector is #logo? (a) an element selector (b) a class selector (c) an id selector
- 34.True or false: JavaScript counts down a timer. (a) False (b) True
-
35.✍️ Which property is set to center in this rule?
p {
text-align: center;
font-weight: bold;
} (a) text-align (b) background-color (c) center (d) margin - 36.Which of these does CSS do? (a) makes headings and lists (b) adds space around boxes (c) changes the page live (d) puts a picture on a page
-
37.🎯 Which CSS selector matches this element?
<span class="box" id="main">Hello</span> (a) p (b) .star (c) span (d) #logo -
38.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 310px;
justify-content: flex-end;
}
Inside are 3 boxes, each 100px wide (no margins). -
39.⚖️ What colour is the text of this element?
<h2 class="star" id="main">Hi</h2>
CSS:
#main { color: blue; }
h2 { color: white; }
.star { color: red; } (a) white (b) purple (c) blue (d) red -
40.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 120px;
padding: 25px;
border: 3px solid black;
margin: 0px;
}
Answer key
- space-between
- <span class="note">
- <h1 id="main">
- yellow
- green
- black
- the later one
- color
- <p class="big">
- on the right
- Yes
- 600px or narrower
- ;
- 800px or wider
- white
- #000000
- <li id="intro">
- display: flex
- False
- True
- purple
- 10
- black
- red
- font-family
- black
- False
- blue
- padding
- :
- <li class="box">
- 20
- an id selector
- True
- text-align
- adds space around boxes
- span
- 10
- blue
- 176
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids