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.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the first one (b) neither (c) the later one (d) the shorter one
- 2.🌈 What is the biggest number one colour can have in rgb()? (a) 100 (b) 1000 (c) 99 (d) 255
-
3.⚖️ What colour is the text of this element?
<h1 class="box" id="top">Hi</h1>
CSS:
h1 { color: yellow; }
h1 { color: white; } (a) yellow (b) purple (c) white (d) orange - 4.🧩 Which language gives the page structure? (a) CSS (b) HTML (c) JavaScript
-
5.⚖️ What colour is the text of this element?
<h1 class="menu" id="hero">Hi</h1>
CSS:
h1 { color: green; }
h1 { color: blue; } (a) blue (b) purple (c) red (d) green - 6.🌈 In #rrggbb, which colour do the first two digits give? (a) black (b) red (c) green (d) blue
- 7.🌈 Which colour is rgb(0, 0, 255)? (a) cyan (b) bright green (c) magenta (d) blue
- 8.🌈 In #240000 the red part is the hex number 24. What is it as a normal number?
- 9.What does background-color do? (a) picks the font style (b) sets the letter colour (c) makes the text bold (d) colours behind the text
- 10.✍️ CSS declarations go inside which brackets? (a) ( ) (b) < > (c) [ ] (d) { }
- 11.🎯 Can many elements share the same class? (a) Yes (b) No
-
12.⚖️ What colour is the text of this element?
<p class="note" id="end">Hi</p>
CSS:
p { color: orange; }
p { color: purple; } (a) green (b) orange (c) purple (d) yellow -
13.⚖️ What colour is the text of this element?
<h1 class="red" id="main">Hi</h1>
CSS:
h1 { color: black; }
h1 { color: purple; } (a) yellow (b) orange (c) black (d) purple -
14.⚖️ What colour is the text of this element?
<p class="big" id="main">Hi</p>
CSS:
p { color: red; }
.big { color: white; }
#main { color: purple; } (a) black (b) red (c) white (d) purple - 15.🎯 Which element does the selector span style? (a) <span class="note"> (b) <p> (c) <h2 id="main"> (d) <h1 class="note">
- 16.✍️ How does a CSS comment start? (a) # (b) // (c) <!-- (d) /*
- 17.🎯 Which element does the selector .big style? (a) <h2 class="box"> (b) <h1 class="big"> (c) <h1 id="big"> (d) <h1 class="red">
- 18.✍️ Which sign ends each CSS declaration? (a) : (b) ; (c) , (d) .
-
19.🎯 Which CSS selector matches this element?
<div class="menu" id="logo">Hello</div> (a) .menu (b) .note (c) span (d) #menu - 20.📱 Responsive design means a page ___. (a) fits every screen (b) is only for laptops (c) never changes (d) has no pictures
-
21.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 768px) {
p {
font-size: 8px;
}
} - 22.🌈 Which colour is rgb(255, 0, 0)? (a) white (b) cyan (c) red (d) black
-
23.⚖️ What colour is the text of this element?
<p class="box" id="hero">Hi</p>
CSS:
p { color: purple; }
#hero { color: red; }
.box { color: green; } (a) green (b) red (c) white (d) purple - 24.What does justify-content: center do? (a) packs boxes at the end (b) packs boxes at the start (c) puts boxes in the middle (d) equal gaps, none at ends
- 25.🧩 Which language changes the text size? (a) JavaScript (b) CSS (c) HTML
-
26.✍️ How many declarations (property: value pairs) are in this rule?
h2 {
font-size: 20px;
} - 27.🌈 Which colour of light is strongest in rgb(38, 222, 16)? (a) red (b) blue (c) green
-
28.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 480px) {
p {
font-size: 28px;
}
} -
29.📱 The screen is 540px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (min-width: 768px) {
p {
font-size: 16px;
}
} (a) Yes (b) No - 30.🎯 What kind of selector is .big? (a) an id selector (b) an element selector (c) a class selector
-
31.🖌️ How big is the text, in px?
li {
text-align: center;
color: blue;
font-size: 36px;
background-color: orange;
} - 32.🧩 Which language puts a picture on a page? (a) HTML (b) CSS (c) JavaScript
- 33.🔍 Which is the odd one out? (a) shows a pop-up message (b) changes the page live (c) gives the page structure (d) checks a quiz answer
- 34.✍️ In color: blue; which part is the value? (a) : (b) ; (c) color (d) blue
-
35.📱 The screen is 820px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 768px) {
p {
font-size: 8px;
}
} (a) No (b) Yes - 36.📱 max-width: 600px applies when the screen is ___. (a) 600px or narrower (b) turned off (c) 600px or wider (d) exactly 1000px
- 37.True or false: #end is an id selector. (a) False (b) True
-
38.✍️ How many declarations (property: value pairs) are in this rule?
h1 {
padding: 8px;
font-size: 20px;
margin: 10px;
font-style: italic;
} - 39.📱 min-width: 800px applies when the screen is ___. (a) 800px or wider (b) exactly 100px (c) turned off (d) 800px or narrower
- 40.📦 In the box model, which part is space outside the border? (a) content (b) margin (c) border (d) padding
Answer key
- the later one
- 255
- white
- HTML
- blue
- red
- blue
- 36
- colours behind the text
- { }
- Yes
- purple
- purple
- purple
- <span class="note">
- /*
- <h1 class="big">
- ;
- .menu
- fits every screen
- 8
- red
- red
- puts boxes in the middle
- CSS
- 1
- green
- 28
- No
- a class selector
- 36
- HTML
- gives the page structure
- blue
- No
- 600px or narrower
- True
- 4
- 800px or wider
- margin
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids