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.🎨 A CSS file usually ends with which extension? (a) .css (b) .html (c) .js (d) .png
- 2.What does font-family do? (a) picks the font style (b) colours behind the text (c) makes letters bigger (d) makes the text bold
- 3.🧩 Which language gives the page structure? (a) HTML (b) JavaScript (c) CSS
- 4.Which of these does CSS do? (a) gives the page structure (b) shows a pop-up message (c) makes a link (d) changes the text size
- 5.🖌️ Which CSS property makes letters bigger? (a) color (b) font-size (c) font-family (d) background-color
-
6.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 70px;
padding: 20px;
border: 1px solid black;
margin: 5px;
} - 7.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the shorter one (c) the first one (d) the later one
- 8.🧩 Which language changes the page live? (a) HTML (b) CSS (c) JavaScript
- 9.🎯 Which sign starts a class selector? (a) & (b) # (c) . (d) @
- 10.True or false: CSS makes a link. (a) True (b) False
- 11.Which of these does HTML do? (a) reacts to a button click (b) makes a form box (c) sets colours and fonts (d) shows a pop-up message
- 12.🌈 Which colour is #000000? (a) red (b) black (c) bright green (d) white
- 13.True or false: p is an element selector. (a) False (b) True
-
14.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 768px) {
p {
font-size: 20px;
}
} - 15.🧩 Which language changes the text size? (a) JavaScript (b) CSS (c) HTML
-
16.⚖️ What colour is the text of this element?
<h1 class="menu" id="hero">Hi</h1>
CSS:
.menu { color: black; }
.menu { color: yellow; } (a) black (b) blue (c) orange (d) yellow -
17.🖌️ What colour are the letters?
h2 {
background-color: green;
text-align: left;
font-size: 16px;
color: purple;
} (a) green (b) black (c) purple -
18.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (min-width: 1024px) {
p {
font-size: 14px;
}
} -
19.🎯 Which CSS selector matches this element?
<p class="red" id="end">Hello</p> (a) #red (b) .box (c) .red (d) .end - 20.🌈 What is the biggest number one colour can have in rgb()? (a) 100 (b) 99 (c) 1000 (d) 255
- 21.🧩 Which language rounds box corners? (a) HTML (b) JavaScript (c) CSS
- 22.🌈 Which colour of light is strongest in rgb(206, 34, 12)? (a) blue (b) red (c) green
-
23.🎯 Which CSS selector matches this element?
<span class="big" id="top">Hello</span> (a) span (b) .red (c) p (d) .top -
24.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 1024px) {
p {
font-size: 16px;
}
} -
25.✍️ What is the selector in this CSS rule?
#top {
background-color: yellow;
font-size: 20px;
border: 2px solid;
} (a) li (b) 20px (c) background-color (d) #top -
26.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 1024px) {
p {
font-size: 24px;
}
} - 27.True or false: body is a class selector. (a) False (b) True
-
28.🖌️ How big is the text, in px?
h1 {
background-color: white;
color: red;
font-size: 36px;
text-align: left;
} -
29.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 480px) {
p {
font-size: 16px;
}
} - 30.True or false: CSS gives the page structure. (a) False (b) True
- 31.True or false: HTML checks a quiz answer. (a) True (b) False
-
32.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 1024px) {
p {
font-size: 32px;
}
} (a) Yes (b) No - 33.🎯 What kind of selector is .note? (a) an id selector (b) an element selector (c) a class selector
-
34.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 170px;
padding: 20px;
border: 4px solid black;
margin: 15px;
} -
35.🎯 Which CSS selector matches this element?
<h1 class="red" id="intro">Hello</h1> (a) #red (b) .box (c) #main (d) #intro - 36.🌈 In #180000 the red part is the hex number 18. What is it as a normal number?
-
37.⚖️ What colour is the text of this element?
<h1 class="red" id="top">Hi</h1>
CSS:
h1 { color: blue; }
#top { color: black; } (a) blue (b) white (c) black (d) red - 38.🎨 One CSS file can style how many pages? (a) only one image (b) no pages (c) only one word (d) many pages
- 39.✍️ Which sign goes between a property and its value? (a) - (b) : (c) ; (d) =
-
40.📱 The screen is 820px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 1024px) {
p {
font-size: 10px;
}
} (a) No (b) Yes
Answer key
- .css
- picks the font style
- HTML
- changes the text size
- font-size
- 122
- the later one
- JavaScript
- .
- False
- makes a form box
- black
- True
- 20
- CSS
- yellow
- purple
- 12
- .red
- 255
- CSS
- red
- span
- 16
- #top
- 16
- False
- 36
- 20
- False
- False
- No
- a class selector
- 218
- #intro
- 24
- black
- many pages
- :
- Yes
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids