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 540px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 600px) {
p {
font-size: 22px;
}
} -
2.✍️ What is the selector in this CSS rule?
body {
font-size: 20px;
font-style: italic;
color: red;
} (a) font-size (b) .box (c) italic (d) body -
3.🖌️ How big is the text, in px?
li {
background-color: white;
color: orange;
text-align: left;
font-size: 36px;
} -
4.🖌️ Where does the text sit on its line?
h2 {
text-align: right;
font-size: 12px;
background-color: green;
color: blue;
} (a) on the right (b) in the middle (c) on the left - 5.🔍 Which is the odd one out? (a) changes the text size (b) makes a link (c) rounds box corners (d) sets colours and fonts
-
6.✍️ What value is given to text-align in this rule?
body {
text-align: center;
font-weight: bold;
padding: 8px;
border: 2px solid;
} (a) center (b) yellow (c) 10px (d) text-align - 7.⚖️ Which selector is the weakest? (a) a class selector (b) an element selector (c) an id selector
- 8.🎯 Which element does the selector h1 style? (a) <h1 class="note"> (b) <li class="note"> (c) <div id="end"> (d) <h2>
- 9.📱 What does a media query check? (a) the battery level (b) the time of day (c) the page title (d) the screen width
- 10.🌈 In #006900 the green part is the hex number 69. What is it as a normal number?
-
11.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 230px;
justify-content: space-between;
}
Inside are 2 boxes, each 100px wide (no margins). - 12.✍️ In color: blue; which part is the property? (a) color (b) blue (c) : (d) ;
-
13.✍️ Which property is set to red in this rule?
body {
font-size: 20px;
color: red;
background-color: yellow;
} (a) font-size (b) red (c) color (d) text-align - 14.Which of these does HTML do? (a) changes the page live (b) puts a picture on a page (c) sets colours and fonts (d) changes the text size
-
15.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 190px;
justify-content: flex-end;
}
Inside are 3 boxes, each 60px wide (no margins). - 16.Which of these does HTML do? (a) changes the page live (b) checks a quiz answer (c) rounds box corners (d) makes a link
-
17.✍️ Which property is set to yellow in this rule?
p {
font-size: 20px;
text-align: center;
background-color: yellow;
} (a) padding (b) margin (c) background-color (d) yellow - 18.🌈 Which hex code is cyan? (a) #ffff00 (b) #00ffff (c) #ffffff (d) #ff00ff
-
19.⚖️ What colour is the text of this element?
<h1 class="star" id="logo">Hi</h1>
CSS:
.star { color: black; }
h1 { color: blue; } (a) green (b) white (c) black (d) blue - 20.✍️ In color: blue; which part is the value? (a) ; (b) : (c) blue (d) color
- 21.🔍 Which is the odd one out? (a) checks a quiz answer (b) changes the text size (c) shows a pop-up message (d) reacts to a button click
- 22.What does background-color do? (a) colours behind the text (b) makes letters bigger (c) picks the font style (d) sets the letter colour
-
23.✍️ What value is given to border in this rule?
.note {
margin: 10px;
border: 2px solid;
} (a) italic (b) 300px (c) border (d) 2px solid - 24.🖌️ Which CSS property picks the font style? (a) font-family (b) text-align (c) background-color (d) color
-
25.⚖️ What colour is the text of this element?
<h2 class="star" id="hero">Hi</h2>
CSS:
#hero { color: purple; }
#hero { color: white; } (a) white (b) yellow (c) purple (d) green -
26.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 270px;
padding: 25px;
border: 3px solid black;
margin: 5px;
} - 27.🧩 Which language changes the text size? (a) JavaScript (b) CSS (c) HTML
-
28.✍️ Which property is set to 8px in this rule?
h1 {
font-size: 20px;
padding: 8px;
} (a) border (b) 8px (c) padding (d) font-weight - 29.Which of these is padding? (a) the gap to other boxes (b) a solid or dotted edge (c) the line round the box (d) the gap round content
- 30.True or false: CSS shows a pop-up message. (a) True (b) False
-
31.🖌️ What colour is behind the letters?
li {
color: yellow;
font-size: 20px;
text-align: right;
background-color: white;
} (a) yellow (b) red (c) white - 32.🎯 Which element does the selector #end style? (a) <span id="end"> (b) <span class="end"> (c) <p class="red"> (d) <span id="hero">
-
33.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 180px;
justify-content: space-between;
}
Inside are 2 boxes, each 80px wide (no margins). -
34.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (max-width: 768px) {
p {
font-size: 18px;
}
} -
35.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 480px) {
p {
font-size: 14px;
}
} -
36.📱 The screen is 540px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 768px) {
p {
font-size: 14px;
}
} (a) Yes (b) No - 37.Which of these does HTML do? (a) changes the text size (b) gives the page structure (c) changes the page live (d) checks a quiz answer
-
38.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 600px) {
p {
font-size: 28px;
}
} - 39.🎨 Which tag connects an outside CSS file? (a) <link> (b) <a> (c) <img> (d) <css>
- 40.🎨 Which tag holds CSS inside the head? (a) <css> (b) <script> (c) <style> (d) <body>
Answer key
- 16
- body
- 36
- on the right
- makes a link
- center
- an element selector
- <h1 class="note">
- the screen width
- 105
- 30
- color
- color
- puts a picture on a page
- 10
- makes a link
- background-color
- #00ffff
- black
- blue
- changes the text size
- colours behind the text
- 2px solid
- font-family
- white
- 326
- CSS
- padding
- the gap round content
- False
- white
- <span id="end">
- 20
- 18
- 16
- Yes
- gives the page structure
- 24
- <link>
- <style>
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids