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.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 480px) {
p {
font-size: 14px;
}
} -
2.🖌️ What colour is behind the letters?
p {
text-align: right;
color: red;
background-color: black;
font-size: 40px;
} (a) red (b) orange (c) black -
3.🖌️ How big is the text, in px?
li {
background-color: green;
text-align: left;
font-size: 16px;
color: orange;
} -
4.✍️ What is the selector in this CSS rule?
#top {
width: 300px;
font-size: 20px;
} (a) 20px (b) width (c) li (d) #top - 5.💪 Which flexbox property picks row or column? (a) display: flex (b) justify-content (c) flex-direction (d) align-items
-
6.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 50px;
padding: 30px;
border: 4px solid black;
margin: 15px;
} - 7.🔍 Which is the odd one out? (a) adds space around boxes (b) changes the text size (c) rounds box corners (d) makes headings and lists
- 8.📱 Which tag helps phones show a page at the right size? (a) the hr tag (b) the title tag (c) the br tag (d) the viewport meta tag
-
9.🖌️ Where does the text sit on its line?
li {
text-align: center;
font-size: 28px;
color: yellow;
background-color: blue;
} (a) on the left (b) on the right (c) in the middle - 10.True or false: the border is the line round the box. (a) False (b) True
- 11.True or false: #main is an id selector. (a) True (b) False
- 12.🖌️ Which CSS property makes letters bigger? (a) font-family (b) font-weight (c) font-size (d) background-color
-
13.⚖️ What colour is the text of this element?
<h1 class="menu" id="hero">Hi</h1>
CSS:
.menu { color: purple; }
.menu { color: blue; } (a) purple (b) blue (c) white (d) black -
14.✍️ What is the selector in this CSS rule?
li {
border: 2px solid;
padding: 8px;
font-size: 20px;
color: red;
} (a) 8px (b) li (c) body (d) border - 15.🌈 Which colour is #0000ff? (a) bright green (b) red (c) blue (d) black
- 16.🧩 Which language makes a link? (a) CSS (b) JavaScript (c) HTML
- 17.What does font-size do? (a) makes letters bigger (b) sets the letter colour (c) makes the text bold (d) colours behind the text
-
18.⚖️ What colour is the text of this element?
<h2 class="menu" id="main">Hi</h2>
CSS:
h2 { color: black; }
.menu { color: green; } (a) orange (b) yellow (c) black (d) green - 19.🧩 Which language counts down a timer? (a) JavaScript (b) CSS (c) HTML
-
20.⚖️ What colour is the text of this element?
<h2 class="star" id="hero">Hi</h2>
CSS:
.star { color: black; }
.star { color: yellow; } (a) blue (b) black (c) green (d) yellow - 21.🎯 Which element does the selector span style? (a) <h2 id="top"> (b) <p> (c) <span class="note"> (d) <h1 class="note">
- 22.🧩 Which language makes a form box? (a) JavaScript (b) CSS (c) HTML
-
23.⚖️ What colour is the text of this element?
<h1 class="big" id="logo">Hi</h1>
CSS:
.big { color: blue; }
.big { color: black; } (a) black (b) green (c) purple (d) blue - 24.🎨 Which tag holds CSS inside the head? (a) <style> (b) <body> (c) <script> (d) <css>
- 25.True or false: margin is space outside the border. (a) True (b) False
-
26.⚖️ What colour is the text of this element?
<h2 class="big" id="top">Hi</h2>
CSS:
h2 { color: purple; }
#top { color: red; }
.big { color: yellow; } (a) red (b) purple (c) yellow (d) orange -
27.✍️ What is the selector in this CSS rule?
p {
font-size: 20px;
text-align: center;
font-style: italic;
background-color: yellow;
} (a) p (b) font-size (c) .note (d) center - 28.True or false: CSS adds space around boxes. (a) True (b) False
- 29.📱 min-width: 800px applies when the screen is ___. (a) 800px or wider (b) turned off (c) 800px or narrower (d) exactly 100px
-
30.🖌️ What colour are the letters?
p {
text-align: center;
color: yellow;
background-color: green;
font-size: 40px;
} (a) blue (b) yellow (c) green -
31.🖌️ Where does the text sit on its line?
p {
text-align: center;
color: yellow;
font-size: 32px;
background-color: black;
} (a) on the left (b) on the right (c) in the middle -
32.⚖️ What colour is the text of this element?
<p class="big" id="logo">Hi</p>
CSS:
p { color: purple; }
.big { color: orange; } (a) green (b) orange (c) purple (d) red -
33.✍️ How many declarations (property: value pairs) are in this rule?
p {
margin: 10px;
padding: 8px;
border: 2px solid;
font-size: 20px;
} - 34.🎨 One CSS file can style how many pages? (a) many pages (b) only one image (c) no pages (d) only one word
- 35.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) the first one (c) neither (d) the later one
-
36.🎯 Which CSS selector matches this element?
<div class="red" id="logo">Hello</div> (a) .red (b) .box (c) span (d) #end - 37.✍️ Which sign goes between a property and its value? (a) : (b) ; (c) = (d) -
- 38.🌈 Which colour is #00ff00? (a) magenta (b) bright green (c) cyan (d) black
- 39.🎯 Which sign starts a class selector? (a) @ (b) & (c) # (d) .
- 40.Which of these does CSS do? (a) makes a form box (b) rounds box corners (c) checks a quiz answer (d) reacts to a button click
Answer key
- 20
- black
- 16
- #top
- flex-direction
- 148
- makes headings and lists
- the viewport meta tag
- in the middle
- True
- True
- font-size
- blue
- li
- blue
- HTML
- makes letters bigger
- green
- JavaScript
- yellow
- <span class="note">
- HTML
- black
- <style>
- True
- red
- p
- True
- 800px or wider
- yellow
- in the middle
- orange
- 4
- many pages
- the later one
- .red
- :
- bright green
- .
- rounds box corners
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids