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 colour is the text of this element?
<h1 class="big" id="logo">Hi</h1>
CSS:
.big { color: black; }
.big { color: green; } (a) blue (b) purple (c) black (d) green -
2.📱 The screen is 1100px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 600px) {
p {
font-size: 6px;
}
} (a) Yes (b) No - 3.🎯 Can many elements share the same class? (a) Yes (b) No
- 4.📱 Which tag helps phones show a page at the right size? (a) the br tag (b) the viewport meta tag (c) the title tag (d) the hr tag
- 5.True or false: CSS sets colours and fonts. (a) True (b) False
-
6.📱 The screen is 700px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 768px) {
p {
font-size: 12px;
}
} (a) Yes (b) No -
7.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 600px) {
p {
font-size: 12px;
}
} -
8.✍️ Which property is set to center in this rule?
p {
margin: 10px;
text-align: center;
} (a) background-color (b) center (c) text-align (d) margin - 9.True or false: JavaScript counts down a timer. (a) True (b) False
-
10.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 220px;
padding: 20px;
border: 4px solid black;
margin: 5px;
} - 11.What does background-color do? (a) centres a heading (b) picks the font style (c) makes the text bold (d) colours behind the text
-
12.✍️ What is the selector in this CSS rule?
li {
border: 2px solid;
padding: 8px;
} (a) border (b) 8px (c) body (d) li -
13.📱 The screen is 1366px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 600px) {
p {
font-size: 32px;
}
} (a) No (b) Yes - 14.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) turned off (c) exactly 100px (d) 800px or wider
-
15.📱 The screen is 540px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (min-width: 600px) {
p {
font-size: 20px;
}
} (a) Yes (b) No - 16.🎨 Which attribute adds CSS inside one tag? (a) src (b) alt (c) style (d) href
- 17.🧩 Which language changes the text size? (a) JavaScript (b) HTML (c) CSS
- 18.⚖️ Which selector is the strongest? (a) an id selector (b) an element selector (c) a class selector
- 19.True or false: JavaScript makes headings and lists. (a) True (b) False
- 20.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 2 (b) 4 (c) 6 (d) 3
- 21.🎯 What kind of selector is .big? (a) a class selector (b) an element selector (c) an id selector
- 22.🎯 Which sign starts a class selector? (a) # (b) & (c) . (d) @
- 23.📦 In the box model, which part is space inside the border? (a) margin (b) border (c) content (d) padding
-
24.✍️ How many declarations (property: value pairs) are in this rule?
body {
margin: 10px;
padding: 8px;
} - 25.✍️ In color: blue; which part is the property? (a) ; (b) : (c) color (d) blue
- 26.🎨 Which tag holds CSS inside the head? (a) <css> (b) <script> (c) <style> (d) <body>
- 27.What does color do? (a) makes letters bigger (b) picks the font style (c) makes the text bold (d) sets the letter colour
- 28.True or false: JavaScript puts a picture on a page. (a) True (b) False
-
29.⚖️ What colour is the text of this element?
<h1 class="big" id="hero">Hi</h1>
CSS:
#hero { color: green; }
#hero { color: white; } (a) yellow (b) black (c) white (d) green -
30.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 480px) {
p {
font-size: 10px;
}
} - 31.🌈 Which colour of light is strongest in rgb(128, 221, 121)? (a) green (b) red (c) blue
- 32.🌈 Which hex code is magenta? (a) #00ff00 (b) #ff00ff (c) #00ffff (d) #ff0000
- 33.🎯 Which element does the selector #intro style? (a) <h1 id="intro"> (b) <h1 id="main"> (c) <h1 class="intro"> (d) <h2 class="box">
- 34.💪 Which justify-content value equal gaps, none at ends? (a) space-between (b) flex-end (c) center (d) flex-start
-
35.🎯 Which CSS selector matches this element?
<li class="star" id="logo">Hello</li> (a) #end (b) div (c) .menu (d) .star -
36.🖌️ Where does the text sit on its line?
h1 {
text-align: right;
color: white;
background-color: black;
font-size: 40px;
} (a) on the left (b) in the middle (c) on the right -
37.✍️ Which property is set to italic in this rule?
h1 {
text-align: center;
padding: 8px;
font-style: italic;
} (a) italic (b) color (c) font-size (d) font-style - 38.🌈 Which colour of light is strongest in rgb(179, 105, 75)? (a) blue (b) green (c) red
-
39.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (min-width: 480px) {
p {
font-size: 28px;
}
} - 40.💪 Which flexbox property lines boxes up across? (a) display: flex (b) gap (c) flex-direction (d) align-items
Answer key
- green
- No
- Yes
- the viewport meta tag
- True
- Yes
- 12
- text-align
- True
- 278
- colours behind the text
- li
- Yes
- 800px or wider
- No
- style
- CSS
- an id selector
- False
- 3
- a class selector
- .
- padding
- 2
- color
- <style>
- sets the letter colour
- False
- white
- 10
- green
- #ff00ff
- <h1 id="intro">
- space-between
- .star
- on the right
- font-style
- red
- 28
- align-items
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids