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 colour is #00ff00? (a) white (b) black (c) yellow (d) bright green
- 2.🌈 In #009a00 the green part is the hex number 9a. What is it as a normal number?
- 3.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the first one (b) the shorter one (c) neither (d) the later one
- 4.🔍 Which is the odd one out? (a) lays out the page (b) shows a pop-up message (c) sets colours and fonts (d) changes the text size
-
5.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 290px;
padding: 30px;
border: 5px solid black;
margin: 0px;
} -
6.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 380px;
justify-content: space-between;
}
Inside are 3 boxes, each 100px wide (no margins). - 7.🌈 Which colour of light is strongest in rgb(121, 122, 161)? (a) red (b) green (c) blue
- 8.💪 Which flexbox property lines boxes up across? (a) display: flex (b) align-items (c) gap (d) justify-content
-
9.✍️ Which property is set to 8px in this rule?
.note {
font-weight: bold;
padding: 8px;
} (a) padding (b) font-weight (c) border (d) 8px - 10.🌈 Which colour is rgb(255, 0, 255)? (a) red (b) white (c) blue (d) magenta
- 11.True or false: .star is an element selector. (a) True (b) False
- 12.🔍 Which is the odd one out? (a) reacts to a button click (b) adds space around boxes (c) shows a pop-up message (d) counts down a timer
- 13.Which of these does CSS do? (a) changes the page live (b) puts a picture on a page (c) rounds box corners (d) counts down a timer
- 14.📱 What does a media query check? (a) the battery level (b) the page title (c) the time of day (d) the screen width
- 15.Which of these does JavaScript do? (a) makes a form box (b) makes a link (c) changes the page live (d) puts a picture on a page
- 16.Which of these is margin? (a) the gap round content (b) space outside the border (c) the text or picture (d) the line round the box
- 17.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) exactly 100px (c) turned off (d) 800px or wider
-
18.📱 The screen is 1366px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (min-width: 600px) {
p {
font-size: 18px;
}
} (a) No (b) Yes -
19.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 120px;
padding: 10px;
border: 4px solid black;
margin: 0px;
} -
20.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 60px;
padding: 5px;
border: 3px solid black;
margin: 10px;
} -
21.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 768px) {
p {
font-size: 16px;
}
} - 22.🔍 Which is the odd one out? (a) reacts to a button click (b) counts down a timer (c) makes a form box (d) changes the page live
-
23.⚖️ What colour is the text of this element?
<p class="menu" id="top">Hi</p>
CSS:
#top { color: green; }
#top { color: red; } (a) orange (b) green (c) red (d) purple - 24.Which of these does JavaScript do? (a) makes a form box (b) lays out the page (c) rounds box corners (d) reacts to a button click
-
25.🖌️ What colour is behind the letters?
h1 {
text-align: right;
font-size: 40px;
color: orange;
background-color: green;
} (a) orange (b) green (c) yellow -
26.✍️ What value is given to margin in this rule?
h1 {
padding: 8px;
margin: 10px;
} (a) margin (b) bold (c) 10px (d) 8px - 27.🎯 What kind of selector is .note? (a) a class selector (b) an id selector (c) an element selector
- 28.🎯 Which element does the selector li style? (a) <div> (b) <p id="hero"> (c) <li class="big"> (d) <span class="big">
- 29.🎯 Which element does the selector h1 style? (a) <h1 class="big"> (b) <li class="big"> (c) <h2> (d) <div id="end">
- 30.✍️ CSS declarations go inside which brackets? (a) { } (b) < > (c) ( ) (d) [ ]
-
31.⚖️ What colour is the text of this element?
<h1 class="box" id="hero">Hi</h1>
CSS:
#hero { color: blue; }
#hero { color: green; } (a) purple (b) white (c) green (d) blue -
32.✍️ How many declarations (property: value pairs) are in this rule?
p {
font-size: 20px;
font-style: italic;
font-weight: bold;
width: 300px;
} - 33.True or false: CSS makes a form box. (a) False (b) True
- 34.📱 Responsive design means a page ___. (a) fits every screen (b) never changes (c) is only for laptops (d) has no pictures
-
35.📱 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;
}
} -
36.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 340px;
justify-content: space-between;
}
Inside are 3 boxes, each 60px wide (no margins). - 37.What does background-color do? (a) centres a heading (b) makes letters bigger (c) makes the text bold (d) colours behind the text
- 38.True or false: p is an id selector. (a) True (b) False
- 39.Which of these does CSS do? (a) puts a picture on a page (b) makes a link (c) lays out the page (d) checks a quiz answer
- 40.✍️ In color: blue; which part is the value? (a) ; (b) color (c) blue (d) :
Answer key
- bright green
- 154
- the later one
- shows a pop-up message
- 360
- 40
- blue
- align-items
- padding
- magenta
- False
- adds space around boxes
- rounds box corners
- the screen width
- changes the page live
- space outside the border
- 800px or wider
- Yes
- 148
- 96
- 16
- makes a form box
- red
- reacts to a button click
- green
- 10px
- a class selector
- <li class="big">
- <h1 class="big">
- { }
- green
- 4
- False
- fits every screen
- 10
- 80
- colours behind the text
- False
- lays out the page
- blue
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids