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 does justify-content: space-between do? (a) packs boxes at the end (b) puts boxes in the middle (c) equal gaps, none at ends (d) packs boxes at the start
- 2.🌈 In #rrggbb, which colour do the last two digits give? (a) red (b) blue (c) white (d) green
- 3.🌈 Which colour is #ffffff? (a) black (b) yellow (c) red (d) white
-
4.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 460px;
justify-content: center;
}
Inside are 4 boxes, each 100px wide (no margins). - 5.Which of these does JavaScript do? (a) lays out the page (b) shows a pop-up message (c) sets colours and fonts (d) makes a link
-
6.🎯 Which CSS selector matches this element?
<h1 class="note" id="main">Hello</h1> (a) .big (b) h2 (c) .main (d) h1 - 7.⚖️ Which selector is the weakest? (a) an element selector (b) a class selector (c) an id selector
-
8.🖌️ Where does the text sit on its line?
h1 {
font-size: 32px;
text-align: left;
color: purple;
background-color: blue;
} (a) in the middle (b) on the left (c) on the right -
9.📱 The screen is 1366px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 1024px) {
p {
font-size: 6px;
}
} (a) Yes (b) No - 10.What does font-size do? (a) centres a heading (b) sets the letter colour (c) makes the text bold (d) makes letters bigger
-
11.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 180px;
padding: 25px;
border: 2px solid black;
margin: 10px;
} - 12.🎨 Which tag holds CSS inside the head? (a) <style> (b) <script> (c) <css> (d) <body>
- 13.True or false: the content is the text or picture. (a) False (b) True
- 14.True or false: CSS rounds box corners. (a) False (b) True
- 15.✍️ In color: blue; which part is the property? (a) : (b) blue (c) ; (d) color
- 16.🖌️ Which CSS property sets the letter colour? (a) background-color (b) font-family (c) font-size (d) color
- 17.📱 What does a media query check? (a) the battery level (b) the screen width (c) the page title (d) the time of day
- 18.True or false: #logo is an element selector. (a) True (b) False
-
19.🖌️ What colour is behind the letters?
p {
color: red;
background-color: blue;
text-align: center;
font-size: 40px;
} (a) blue (b) white (c) red - 20.🌈 Which hex code is bright green? (a) #00ffff (b) #ffff00 (c) #00ff00 (d) #ff00ff
-
21.✍️ What value is given to font-weight in this rule?
li {
text-align: center;
font-weight: bold;
} (a) font-weight (b) 2px solid (c) bold (d) 300px - 22.Which of these does JavaScript do? (a) puts a picture on a page (b) reacts to a button click (c) makes a form box (d) makes a link
-
23.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 768px) {
p {
font-size: 10px;
}
} - 24.💪 Which justify-content value packs boxes at the end? (a) flex-start (b) flex-end (c) center (d) space-between
- 25.💪 Which flexbox property turns on flexbox? (a) flex-direction (b) align-items (c) justify-content (d) display: flex
- 26.Which of these does CSS do? (a) rounds box corners (b) changes the page live (c) shows a pop-up message (d) makes a form box
-
27.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 1024px) {
p {
font-size: 10px;
}
} -
28.🎯 Which CSS selector matches this element?
<span class="note" id="hero">Hello</span> (a) span (b) p (c) #note (d) #top -
29.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 290px;
padding: 25px;
border: 1px solid black;
margin: 15px;
} - 30.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 3 (b) 6 (c) 2 (d) 4
- 31.True or false: .card is an id selector. (a) False (b) True
- 32.🧩 Which language adds space around boxes? (a) JavaScript (b) CSS (c) HTML
- 33.🌈 Which colour is rgb(255, 0, 0)? (a) white (b) yellow (c) red (d) blue
- 34.True or false: CSS checks a quiz answer. (a) True (b) False
- 35.✍️ Which sign goes between a property and its value? (a) - (b) : (c) ; (d) =
-
36.💪 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 40px wide (no margins). -
37.⚖️ What colour is the text of this element?
<p class="big" id="hero">Hi</p>
CSS:
.big { color: yellow; }
p { color: green; } (a) green (b) yellow (c) red (d) white -
38.✍️ How many declarations (property: value pairs) are in this rule?
li {
font-weight: bold;
margin: 10px;
color: red;
} -
39.✍️ How many declarations (property: value pairs) are in this rule?
h1 {
width: 300px;
font-weight: bold;
padding: 8px;
} - 40.✍️ Which sign ends each CSS declaration? (a) . (b) ; (c) : (d) ,
Answer key
- equal gaps, none at ends
- blue
- white
- 30
- shows a pop-up message
- h1
- an element selector
- on the left
- No
- makes letters bigger
- 254
- <style>
- True
- True
- color
- color
- the screen width
- False
- blue
- #00ff00
- bold
- reacts to a button click
- 10
- flex-end
- display: flex
- rounds box corners
- 10
- span
- 342
- 3
- False
- CSS
- red
- False
- :
- 60
- yellow
- 3
- 3
- ;
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids