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.🌈 In #d40000 the red part is the hex number d4. What is it as a normal number?
- 2.✍️ How does a CSS comment start? (a) // (b) /* (c) # (d) <!--
- 3.What does background-color do? (a) colours behind the text (b) makes letters bigger (c) centres a heading (d) picks the font style
-
4.⚖️ What colour is the text of this element?
<h2 class="note" id="top">Hi</h2>
CSS:
h2 { color: blue; }
h2 { color: purple; } (a) black (b) orange (c) blue (d) purple -
5.🖌️ How big is the text, in px?
li {
text-align: left;
background-color: blue;
font-size: 12px;
color: green;
} - 6.🧩 Which language checks a quiz answer? (a) CSS (b) HTML (c) JavaScript
-
7.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 100px;
justify-content: flex-end;
}
Inside are 2 boxes, each 40px wide (no margins). - 8.Which of these does JavaScript do? (a) changes the text size (b) rounds box corners (c) adds space around boxes (d) reacts to a button click
- 9.🔍 Which is the odd one out? (a) counts down a timer (b) reacts to a button click (c) changes the page live (d) lays out the page
-
10.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 140px;
justify-content: flex-start;
}
Inside are 2 boxes, each 60px wide (no margins). - 11.🎯 Which element does the selector .menu style? (a) <h1 id="menu"> (b) <h1 class="note"> (c) <h1 class="menu"> (d) <h2 class="big">
- 12.📱 Responsive design means a page ___. (a) fits every screen (b) is only for laptops (c) has no pictures (d) never changes
-
13.🖌️ What colour is behind the letters?
li {
background-color: red;
text-align: center;
font-size: 24px;
color: blue;
} (a) orange (b) blue (c) red -
14.⚖️ What colour is the text of this element?
<h1 class="star" id="hero">Hi</h1>
CSS:
h1 { color: red; }
h1 { color: white; } (a) white (b) black (c) green (d) red -
15.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 280px;
padding: 20px;
border: 1px solid black;
margin: 10px;
} -
16.⚖️ What colour is the text of this element?
<h2 class="red" id="intro">Hi</h2>
CSS:
.red { color: yellow; }
.red { color: purple; } (a) red (b) purple (c) black (d) yellow -
17.✍️ How many declarations (property: value pairs) are in this rule?
li {
color: red;
} -
18.🎯 Which CSS selector matches this element?
<li class="note" id="logo">Hello</li> (a) .note (b) .big (c) #end (d) #note - 19.What does text-align do? (a) colours behind the text (b) centres a heading (c) makes the text bold (d) makes letters bigger
- 20.⚖️ Which selector is the strongest? (a) a class selector (b) an element selector (c) an id selector
- 21.📱 max-width: 600px applies when the screen is ___. (a) turned off (b) 600px or narrower (c) exactly 1000px (d) 600px or wider
-
22.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 600px) {
p {
font-size: 10px;
}
} -
23.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 130px;
justify-content: space-between;
}
Inside are 2 boxes, each 40px wide (no margins). - 24.🌈 Which colour is rgb(255, 0, 0)? (a) red (b) cyan (c) white (d) black
- 25.📦 In the box model, which part is the gap to other boxes? (a) content (b) margin (c) border (d) padding
-
26.🖌️ What colour are the letters?
li {
text-align: right;
color: red;
font-size: 40px;
background-color: green;
} (a) green (b) red (c) black - 27.🖌️ Which CSS property centres a heading? (a) font-size (b) font-weight (c) font-family (d) text-align
-
28.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 768px) {
p {
font-size: 18px;
}
} -
29.✍️ Which property is set to 2px solid in this rule?
p {
font-size: 20px;
border: 2px solid;
color: red;
font-style: italic;
} (a) border (b) font-style (c) width (d) 2px solid - 30.Which of these does HTML do? (a) gives the page structure (b) changes the text size (c) shows a pop-up message (d) checks a quiz answer
- 31.🎨 One CSS file can style how many pages? (a) no pages (b) only one word (c) many pages (d) only one image
- 32.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 2 (b) 3 (c) 4 (d) 6
- 33.🎯 Which element does the selector h1 style? (a) <div id="main"> (b) <li class="note"> (c) <h1 class="note"> (d) <h2>
-
34.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 170px;
justify-content: flex-end;
}
Inside are 2 boxes, each 80px wide (no margins). - 35.Which of these does JavaScript do? (a) puts a picture on a page (b) gives the page structure (c) counts down a timer (d) makes a link
-
36.⚖️ What colour is the text of this element?
<p class="star" id="intro">Hi</p>
CSS:
#intro { color: white; }
.star { color: orange; } (a) green (b) black (c) white (d) orange -
37.🖌️ What colour is behind the letters?
h2 {
font-size: 40px;
text-align: right;
color: purple;
background-color: blue;
} (a) purple (b) yellow (c) blue -
38.⚖️ What colour is the text of this element?
<p class="note" id="intro">Hi</p>
CSS:
.note { color: white; }
#intro { color: purple; }
p { color: red; } (a) white (b) orange (c) red (d) purple - 39.🧩 Which language lays out the page? (a) HTML (b) JavaScript (c) CSS
-
40.📱 The screen is 1100px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (max-width: 480px) {
p {
font-size: 16px;
}
} (a) Yes (b) No
Answer key
- 212
- /*
- colours behind the text
- purple
- 12
- JavaScript
- 20
- reacts to a button click
- lays out the page
- 20
- <h1 class="menu">
- fits every screen
- red
- white
- 322
- purple
- 1
- .note
- centres a heading
- an id selector
- 600px or narrower
- 10
- 50
- red
- margin
- red
- text-align
- 16
- border
- gives the page structure
- many pages
- 3
- <h1 class="note">
- 10
- counts down a timer
- white
- blue
- purple
- CSS
- No
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids