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 of light is strongest in rgb(186, 98, 2)? (a) blue (b) red (c) green
- 2.🌈 In #00d200 the green part is the hex number d2. What is it as a normal number?
- 3.🔍 Which is the odd one out? (a) adds space around boxes (b) sets colours and fonts (c) lays out the page (d) makes a form box
- 4.🖌️ Which CSS property colours behind the text? (a) background-color (b) font-size (c) color (d) font-family
- 5.📱 What does a media query check? (a) the battery level (b) the screen width (c) the page title (d) the time of day
- 6.🧩 Which language lays out the page? (a) CSS (b) HTML (c) JavaScript
- 7.🌈 Which hex code is magenta? (a) #ff0000 (b) #00ff00 (c) #0000ff (d) #ff00ff
-
8.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 180px;
padding: 20px;
border: 5px solid black;
margin: 0px;
} - 9.🌈 Which colour is #000000? (a) black (b) yellow (c) bright green (d) magenta
- 10.🌈 Which hex code is blue? (a) #0000ff (b) #000000 (c) #ffff00 (d) #ff0000
- 11.🎨 One CSS file can style how many pages? (a) only one image (b) only one word (c) many pages (d) no pages
- 12.📱 max-width: 600px applies when the screen is ___. (a) turned off (b) 600px or wider (c) exactly 1000px (d) 600px or narrower
- 13.What does justify-content: space-between do? (a) equal gaps, none at ends (b) packs boxes at the start (c) packs boxes at the end (d) puts boxes in the middle
- 14.True or false: margin is space outside the border. (a) True (b) False
- 15.🌈 In #rrggbb, which colour do the last two digits give? (a) green (b) blue (c) white (d) red
- 16.What does text-align do? (a) picks the font style (b) colours behind the text (c) centres a heading (d) makes the text bold
- 17.🎯 Can many elements share the same class? (a) No (b) Yes
- 18.🖌️ Which CSS property picks the font style? (a) background-color (b) font-size (c) text-align (d) font-family
- 19.💪 Which flexbox property turns on flexbox? (a) gap (b) display: flex (c) flex-direction (d) align-items
- 20.🖌️ Which CSS property sets the letter colour? (a) font-weight (b) font-size (c) color (d) background-color
-
21.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 240px;
justify-content: flex-start;
}
Inside are 2 boxes, each 80px wide (no margins). -
22.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 420px;
justify-content: center;
}
Inside are 4 boxes, each 80px wide (no margins). - 23.True or false: padding is space inside the border. (a) True (b) False
- 24.True or false: .note is an element selector. (a) False (b) True
- 25.🧩 Which language makes headings and lists? (a) JavaScript (b) HTML (c) CSS
-
26.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (max-width: 768px) {
p {
font-size: 22px;
}
} (a) No (b) Yes -
27.📱 The screen is 1100px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 480px) {
p {
font-size: 10px;
}
} (a) No (b) Yes -
28.✍️ What value is given to width in this rule?
h1 {
width: 300px;
font-size: 20px;
border: 2px solid;
} (a) red (b) italic (c) 300px (d) width - 29.What does justify-content: flex-start do? (a) packs boxes at the end (b) puts boxes in the middle (c) equal gaps, none at ends (d) packs boxes at the start
- 30.✍️ Which sign ends each CSS declaration? (a) : (b) . (c) ; (d) ,
-
31.🎯 Which CSS selector matches this element?
<h2 class="red" id="main">Hello</h2> (a) li (b) #red (c) .box (d) h2 -
32.🎯 Which CSS selector matches this element?
<span class="big" id="intro">Hello</span> (a) #big (b) #main (c) span (d) .intro - 33.True or false: the border is space inside the border. (a) False (b) True
- 34.⚖️ Which selector is the weakest? (a) an element selector (b) an id selector (c) a class selector
- 35.💪 Which justify-content value packs boxes at the end? (a) flex-start (b) center (c) space-between (d) flex-end
-
36.✍️ How many declarations (property: value pairs) are in this rule?
body {
color: red;
font-style: italic;
font-size: 20px;
width: 300px;
} -
37.⚖️ What colour is the text of this element?
<h1 class="big" id="top">Hi</h1>
CSS:
h1 { color: yellow; }
.big { color: blue; } (a) purple (b) blue (c) yellow (d) red -
38.🎯 Which CSS selector matches this element?
<h1 class="note" id="hero">Hello</h1> (a) #hero (b) h2 (c) .hero (d) #note -
39.⚖️ What colour is the text of this element?
<p class="menu" id="hero">Hi</p>
CSS:
.menu { color: red; }
.menu { color: white; } (a) white (b) red (c) green (d) blue - 40.🎯 What kind of selector is #hero? (a) an id selector (b) a class selector (c) an element selector
Answer key
- red
- 210
- makes a form box
- background-color
- the screen width
- CSS
- #ff00ff
- 230
- black
- #0000ff
- many pages
- 600px or narrower
- equal gaps, none at ends
- True
- blue
- centres a heading
- Yes
- font-family
- display: flex
- color
- 80
- 50
- True
- False
- HTML
- Yes
- No
- 300px
- packs boxes at the start
- ;
- h2
- span
- False
- an element selector
- flex-end
- 4
- blue
- #hero
- white
- an id selector
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids