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 kind of selector is #main? (a) a class selector (b) an element selector (c) an id selector
-
2.🖌️ How big is the text, in px?
li {
background-color: black;
text-align: right;
font-size: 36px;
color: orange;
} - 3.True or false: HTML shows a pop-up message. (a) True (b) False
- 4.True or false: .card is an id selector. (a) False (b) True
-
5.📱 The screen is 700px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (max-width: 480px) {
p {
font-size: 20px;
}
} (a) Yes (b) No -
6.🖌️ What colour is behind the letters?
h1 {
text-align: center;
color: white;
background-color: red;
font-size: 28px;
} (a) white (b) blue (c) red - 7.✍️ In color: blue; which part is the property? (a) color (b) blue (c) ; (d) :
- 8.⚖️ Which selector is the weakest? (a) a class selector (b) an id selector (c) an element selector
-
9.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 240px;
justify-content: flex-start;
}
Inside are 4 boxes, each 50px wide (no margins). - 10.💪 Which justify-content value equal gaps, none at ends? (a) space-between (b) center (c) flex-end (d) flex-start
- 11.💪 Which flexbox property spaces boxes along a row? (a) display: flex (b) align-items (c) justify-content (d) gap
- 12.🎯 Which element does the selector h2 style? (a) <span id="end"> (b) <div class="note"> (c) <li> (d) <h2 class="note">
-
13.✍️ What value is given to font-weight in this rule?
body {
font-weight: bold;
background-color: yellow;
padding: 8px;
} (a) bold (b) font-weight (c) 2px solid (d) 300px - 14.True or false: .note is an id selector. (a) True (b) False
- 15.🌈 In #00cc00 the green part is the hex number cc. What is it as a normal number?
- 16.💪 Which flexbox property lines boxes up across? (a) justify-content (b) align-items (c) gap (d) flex-direction
- 17.🌈 Which colour of light is strongest in rgb(29, 199, 77)? (a) green (b) blue (c) red
-
18.⚖️ What colour is the text of this element?
<p class="box" id="logo">Hi</p>
CSS:
.box { color: purple; }
p { color: yellow; } (a) yellow (b) red (c) orange (d) purple - 19.🧩 Which language changes the page live? (a) CSS (b) JavaScript (c) HTML
- 20.🖌️ Which CSS property sets the letter colour? (a) font-size (b) font-family (c) text-align (d) color
- 21.Which of these does HTML do? (a) rounds box corners (b) shows a pop-up message (c) counts down a timer (d) makes a form box
-
22.🖌️ Where does the text sit on its line?
h1 {
text-align: right;
font-size: 24px;
background-color: yellow;
color: green;
} (a) in the middle (b) on the left (c) on the right -
23.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 240px;
padding: 30px;
border: 1px solid black;
margin: 0px;
} -
24.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 130px;
justify-content: flex-start;
}
Inside are 2 boxes, each 60px wide (no margins). - 25.Which of these does CSS do? (a) changes the page live (b) counts down a timer (c) sets colours and fonts (d) puts a picture on a page
- 26.Which of these does JavaScript do? (a) makes a form box (b) counts down a timer (c) gives the page structure (d) changes the text size
- 27.📱 Which tag helps phones show a page at the right size? (a) the viewport meta tag (b) the br tag (c) the hr tag (d) the title tag
- 28.🖌️ Which CSS property picks the font style? (a) color (b) text-align (c) font-size (d) font-family
-
29.✍️ What value is given to color in this rule?
#top {
color: red;
text-align: center;
font-size: 20px;
background-color: yellow;
} (a) color (b) red (c) 20px (d) center - 30.What does font-weight do? (a) makes letters bigger (b) colours behind the text (c) makes the text bold (d) sets the letter colour
- 31.🎯 Which sign starts a class selector? (a) . (b) & (c) # (d) @
-
32.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 380px;
justify-content: center;
}
Inside are 3 boxes, each 80px wide (no margins). -
33.🖌️ How big is the text, in px?
li {
color: blue;
background-color: yellow;
font-size: 40px;
text-align: left;
} - 34.🔍 Which is the odd one out? (a) gives the page structure (b) makes a form box (c) makes a link (d) reacts to a button click
- 35.🖌️ Which CSS property makes the text bold? (a) text-align (b) color (c) background-color (d) font-weight
- 36.📱 Responsive design means a page ___. (a) is only for laptops (b) fits every screen (c) never changes (d) has no pictures
- 37.True or false: JavaScript puts a picture on a page. (a) True (b) False
-
38.🖌️ What colour is behind the letters?
p {
font-size: 16px;
text-align: center;
color: white;
background-color: black;
} (a) black (b) white (c) blue - 39.🔍 Which is the odd one out? (a) adds space around boxes (b) puts a picture on a page (c) makes a link (d) gives the page structure
-
40.📱 The screen is 1100px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (min-width: 600px) {
p {
font-size: 14px;
}
} (a) No (b) Yes
Answer key
- an id selector
- 36
- False
- False
- No
- red
- color
- an element selector
- 40
- space-between
- justify-content
- <h2 class="note">
- bold
- False
- 204
- align-items
- green
- purple
- JavaScript
- color
- makes a form box
- on the right
- 302
- 10
- sets colours and fonts
- counts down a timer
- the viewport meta tag
- font-family
- red
- makes the text bold
- .
- 70
- 40
- reacts to a button click
- font-weight
- fits every screen
- False
- black
- adds space around boxes
- Yes
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids