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 of these does HTML do? (a) makes a link (b) lays out the page (c) changes the page live (d) sets colours and fonts
- 2.🌈 In #rrggbb, which colour do the last two digits give? (a) green (b) red (c) white (d) blue
- 3.📦 In the box model, which part is the gap round content? (a) content (b) margin (c) border (d) padding
- 4.📦 In the box model, which part is the text or picture? (a) content (b) border (c) margin (d) padding
- 5.🌈 Which colour is #ff00ff? (a) magenta (b) black (c) yellow (d) cyan
-
6.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 768px) {
p {
font-size: 6px;
}
} - 7.🌈 Which hex code is black? (a) #00ffff (b) #000000 (c) #ffffff (d) #ff0000
- 8.💪 Which justify-content value equal gaps, none at ends? (a) center (b) flex-end (c) space-between (d) flex-start
-
9.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 220px;
justify-content: flex-start;
}
Inside are 3 boxes, each 50px wide (no margins). - 10.🎯 Which element does the selector p style? (a) <h2 class="note"> (b) <h1> (c) <p class="note"> (d) <li id="intro">
- 11.🌈 Which colour of light is strongest in rgb(187, 10, 54)? (a) red (b) green (c) blue
-
12.✍️ Which property is set to yellow in this rule?
h1 {
border: 2px solid;
color: red;
background-color: yellow;
} (a) background-color (b) margin (c) yellow (d) padding - 13.✍️ Which sign goes between a property and its value? (a) : (b) ; (c) = (d) -
-
14.✍️ Which property is set to 8px in this rule?
h1 {
font-style: italic;
text-align: center;
padding: 8px;
margin: 10px;
} (a) border (b) font-weight (c) 8px (d) padding - 15.🌈 Which colour is rgb(0, 255, 0)? (a) white (b) bright green (c) blue (d) magenta
- 16.📱 Which tag helps phones show a page at the right size? (a) the br tag (b) the viewport meta tag (c) the title tag (d) the hr tag
-
17.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 480px) {
p {
font-size: 28px;
}
} - 18.True or false: the border is space outside the border. (a) True (b) False
- 19.🖌️ Which CSS property sets the letter colour? (a) font-weight (b) color (c) font-family (d) text-align
- 20.🎯 Which element does the selector div style? (a) <h1 id="logo"> (b) <div class="menu"> (c) <p class="menu"> (d) <span>
- 21.🧩 Which language changes the text size? (a) CSS (b) HTML (c) JavaScript
-
22.✍️ What is the selector in this CSS rule?
li {
width: 300px;
color: red;
margin: 10px;
} (a) red (b) width (c) body (d) li -
23.⚖️ What colour is the text of this element?
<h2 class="star" id="end">Hi</h2>
CSS:
#end { color: black; }
h2 { color: red; }
.star { color: purple; } (a) red (b) green (c) black (d) purple -
24.✍️ What is the selector in this CSS rule?
li {
text-align: center;
font-style: italic;
padding: 8px;
} (a) text-align (b) italic (c) li (d) body - 25.What does justify-content: center do? (a) packs boxes at the start (b) equal gaps, none at ends (c) packs boxes at the end (d) puts boxes in the middle
-
26.⚖️ What colour is the text of this element?
<h2 class="big" id="main">Hi</h2>
CSS:
h2 { color: white; }
h2 { color: purple; } (a) purple (b) white (c) black (d) orange -
27.🖌️ How big is the text, in px?
h2 {
font-size: 28px;
background-color: yellow;
text-align: left;
color: blue;
} - 28.🎯 Which element does the selector h2 style? (a) <li> (b) <h2 class="menu"> (c) <span id="top"> (d) <div class="menu">
- 29.What does justify-content: flex-end do? (a) packs boxes at the end (b) puts boxes in the middle (c) packs boxes at the start (d) equal gaps, none at ends
- 30.True or false: JavaScript reacts to a button click. (a) False (b) True
- 31.🔍 Which is the odd one out? (a) makes a form box (b) checks a quiz answer (c) puts a picture on a page (d) makes a link
- 32.🌈 Which colour is #ffffff? (a) yellow (b) blue (c) black (d) white
- 33.📱 Responsive design means a page ___. (a) never changes (b) is only for laptops (c) fits every screen (d) has no pictures
-
34.📱 The screen is 1100px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 1024px) {
p {
font-size: 8px;
}
} (a) Yes (b) No -
35.⚖️ What colour is the text of this element?
<h2 class="big" id="top">Hi</h2>
CSS:
#top { color: purple; }
h2 { color: white; } (a) yellow (b) white (c) orange (d) purple - 36.💪 Which flexbox property lines boxes up across? (a) display: flex (b) justify-content (c) gap (d) align-items
- 37.🌈 Which colour of light is strongest in rgb(43, 186, 14)? (a) red (b) blue (c) green
-
38.⚖️ What colour is the text of this element?
<p class="menu" id="top">Hi</p>
CSS:
p { color: white; }
p { color: blue; } (a) white (b) black (c) blue (d) red - 39.🌈 What is the biggest number one colour can have in rgb()? (a) 100 (b) 255 (c) 99 (d) 1000
- 40.🌈 Which colour of light is strongest in rgb(77, 131, 222)? (a) blue (b) green (c) red
Answer key
- makes a link
- blue
- padding
- content
- magenta
- 12
- #000000
- space-between
- 70
- <p class="note">
- red
- background-color
- :
- padding
- bright green
- the viewport meta tag
- 24
- False
- color
- <div class="menu">
- CSS
- li
- black
- li
- puts boxes in the middle
- purple
- 28
- <h2 class="menu">
- packs boxes at the end
- True
- checks a quiz answer
- white
- fits every screen
- No
- purple
- align-items
- green
- blue
- 255
- blue
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids