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.🎯 What kind of selector is .menu? (a) an id selector (b) an element selector (c) a class selector
- 2.Which of these is margin? (a) space inside the border (b) a solid or dotted edge (c) the gap to other boxes (d) the gap round content
-
3.💪 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). - 4.What does font-family do? (a) picks the font style (b) makes letters bigger (c) colours behind the text (d) centres a heading
-
5.⚖️ What colour is the text of this element?
<p class="note" id="top">Hi</p>
CSS:
#top { color: black; }
#top { color: red; } (a) blue (b) red (c) black (d) yellow - 6.What does font-weight do? (a) centres a heading (b) makes letters bigger (c) colours behind the text (d) makes the text bold
-
7.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 180px;
justify-content: flex-end;
}
Inside are 2 boxes, each 60px wide (no margins). - 8.True or false: margin is the gap to other boxes. (a) False (b) True
- 9.🧩 Which language makes headings and lists? (a) JavaScript (b) CSS (c) HTML
-
10.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 1024px) {
p {
font-size: 18px;
}
} - 11.🎯 How many elements on a page should have the same id? (a) 2 (b) 5 (c) any number (d) 1
- 12.True or false: padding is the gap round content. (a) False (b) True
- 13.🌈 Which hex code is black? (a) #000000 (b) #ff0000 (c) #ffffff (d) #0000ff
- 14.⚖️ Which selector is the strongest? (a) a class selector (b) an id selector (c) an element selector
- 15.📱 Responsive design means a page ___. (a) has no pictures (b) never changes (c) is only for laptops (d) fits every screen
- 16.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the first one (c) the later one (d) the shorter one
-
17.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 600px) {
p {
font-size: 18px;
}
} - 18.True or false: JavaScript checks a quiz answer. (a) False (b) True
- 19.🔍 Which is the odd one out? (a) shows a pop-up message (b) changes the page live (c) sets colours and fonts (d) counts down a timer
- 20.🌈 In #0000f3 the blue part is the hex number f3. What is it as a normal number?
- 21.🖌️ Which CSS property picks the font style? (a) background-color (b) font-family (c) font-weight (d) text-align
- 22.🌈 In #0000dc the blue part is the hex number dc. What is it as a normal number?
-
23.⚖️ What colour is the text of this element?
<h1 class="red" id="intro">Hi</h1>
CSS:
#intro { color: black; }
#intro { color: white; } (a) orange (b) red (c) black (d) white -
24.⚖️ What colour is the text of this element?
<h1 class="note" id="top">Hi</h1>
CSS:
#top { color: green; }
#top { color: purple; } (a) red (b) yellow (c) purple (d) green -
25.✍️ Which property is set to 20px in this rule?
.box {
font-weight: bold;
background-color: yellow;
border: 2px solid;
font-size: 20px;
} (a) 20px (b) font-size (c) background-color (d) text-align - 26.🎯 Can many elements share the same class? (a) Yes (b) No
-
27.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 220px;
justify-content: center;
}
Inside are 2 boxes, each 100px wide (no margins). - 28.⚖️ Which selector is the weakest? (a) an element selector (b) an id selector (c) a class selector
- 29.🌈 In #660000 the red part is the hex number 66. What is it as a normal number?
-
30.✍️ Which property is set to red in this rule?
h1 {
padding: 8px;
text-align: center;
color: red;
} (a) text-align (b) font-size (c) red (d) color - 31.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) exactly 100px (c) 800px or wider (d) turned off
- 32.True or false: margin is the text or picture. (a) True (b) False
-
33.⚖️ What colour is the text of this element?
<p class="note" id="top">Hi</p>
CSS:
#top { color: black; }
#top { color: orange; } (a) green (b) black (c) white (d) orange -
34.🖌️ How big is the text, in px?
h1 {
font-size: 16px;
text-align: right;
background-color: orange;
color: purple;
} - 35.🧩 Which language puts a picture on a page? (a) CSS (b) HTML (c) JavaScript
-
36.⚖️ What colour is the text of this element?
<h1 class="star" id="top">Hi</h1>
CSS:
#top { color: purple; }
#top { color: orange; } (a) blue (b) orange (c) red (d) purple - 37.✍️ How does a CSS comment start? (a) # (b) /* (c) // (d) <!--
- 38.🎯 Which element does the selector h2 style? (a) <span id="main"> (b) <h2 class="note"> (c) <div class="note"> (d) <li>
- 39.🖌️ Which CSS property sets the letter colour? (a) background-color (b) color (c) font-weight (d) text-align
-
40.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 230px;
padding: 10px;
border: 1px solid black;
margin: 20px;
}
Answer key
- a class selector
- the gap to other boxes
- 20
- picks the font style
- red
- makes the text bold
- 60
- True
- HTML
- 16
- 1
- True
- #000000
- an id selector
- fits every screen
- the later one
- 20
- True
- sets colours and fonts
- 243
- font-family
- 220
- white
- purple
- font-size
- Yes
- 10
- an element selector
- 102
- color
- 800px or wider
- False
- orange
- 16
- HTML
- orange
- /*
- <h2 class="note">
- color
- 292
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids