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 375px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 768px) {
p {
font-size: 26px;
}
} (a) No (b) Yes - 2.💪 Which flexbox property turns on flexbox? (a) gap (b) align-items (c) display: flex (d) justify-content
- 3.🌈 In #bc0000 the red part is the hex number bc. What is it as a normal number?
- 4.Which of these does HTML do? (a) makes a link (b) checks a quiz answer (c) changes the text size (d) shows a pop-up message
-
5.🎯 Which CSS selector matches this element?
<h1 class="note" id="main">Hello</h1> (a) .note (b) #note (c) .main (d) #logo - 6.What does justify-content: flex-end do? (a) equal gaps, none at ends (b) packs boxes at the end (c) puts boxes in the middle (d) packs boxes at the start
-
7.⚖️ What colour is the text of this element?
<p class="menu" id="main">Hi</p>
CSS:
p { color: white; }
p { color: red; } (a) purple (b) orange (c) red (d) white - 8.Which of these does CSS do? (a) rounds box corners (b) counts down a timer (c) shows a pop-up message (d) makes headings and lists
-
9.📱 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;
}
} - 10.📦 In the box model, which part is space inside the border? (a) border (b) margin (c) content (d) padding
- 11.What does font-weight do? (a) sets the letter colour (b) makes letters bigger (c) picks the font style (d) makes the text bold
-
12.✍️ Which property is set to yellow in this rule?
.note {
font-size: 20px;
text-align: center;
font-weight: bold;
background-color: yellow;
} (a) padding (b) background-color (c) margin (d) yellow - 13.True or false: .card is a class selector. (a) True (b) False
- 14.🌈 In #rrggbb, which colour do the last two digits give? (a) red (b) white (c) green (d) blue
- 15.What does text-align do? (a) colours behind the text (b) sets the letter colour (c) makes the text bold (d) centres a heading
- 16.What does color do? (a) centres a heading (b) makes the text bold (c) colours behind the text (d) sets the letter colour
- 17.What does justify-content: space-between do? (a) puts boxes in the middle (b) packs boxes at the start (c) equal gaps, none at ends (d) packs boxes at the end
- 18.💪 Which justify-content value equal gaps, none at ends? (a) flex-start (b) flex-end (c) center (d) space-between
-
19.✍️ What value is given to text-align in this rule?
h1 {
text-align: center;
color: red;
border: 2px solid;
} (a) center (b) 10px (c) text-align (d) yellow - 20.What does justify-content: center do? (a) packs boxes at the end (b) puts boxes in the middle (c) packs boxes at the start (d) equal gaps, none at ends
-
21.✍️ How many declarations (property: value pairs) are in this rule?
.box {
padding: 8px;
margin: 10px;
border: 2px solid;
} -
22.✍️ How many declarations (property: value pairs) are in this rule?
.note {
font-size: 20px;
color: red;
} - 23.✍️ Which sign ends each CSS declaration? (a) : (b) ; (c) . (d) ,
- 24.📱 max-width: 600px applies when the screen is ___. (a) exactly 1000px (b) 600px or narrower (c) turned off (d) 600px or wider
-
25.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 270px;
padding: 25px;
border: 5px solid black;
margin: 0px;
} - 26.📱 Responsive design means a page ___. (a) fits every screen (b) has no pictures (c) never changes (d) is only for laptops
-
27.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 200px;
justify-content: flex-end;
}
Inside are 2 boxes, each 80px wide (no margins). -
28.✍️ What value is given to text-align in this rule?
h2 {
font-weight: bold;
background-color: yellow;
text-align: center;
width: 300px;
} (a) yellow (b) 10px (c) center (d) text-align - 29.🌈 Which colour of light is strongest in rgb(247, 99, 126)? (a) red (b) green (c) blue
- 30.🌈 Which colour is rgb(255, 255, 0)? (a) blue (b) white (c) cyan (d) yellow
- 31.📱 Which tag helps phones show a page at the right size? (a) the hr tag (b) the br tag (c) the title tag (d) the viewport meta tag
-
32.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 190px;
justify-content: space-between;
}
Inside are 2 boxes, each 60px wide (no margins). -
33.⚖️ What colour is the text of this element?
<h2 class="menu" id="end">Hi</h2>
CSS:
#end { color: blue; }
#end { color: yellow; } (a) purple (b) red (c) blue (d) yellow - 34.🔍 Which is the odd one out? (a) counts down a timer (b) checks a quiz answer (c) shows a pop-up message (d) puts a picture on a page
-
35.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 260px;
padding: 15px;
border: 4px solid black;
margin: 20px;
} -
36.🎯 Which CSS selector matches this element?
<li class="menu" id="logo">Hello</li> (a) #menu (b) #logo (c) #end (d) div - 37.📦 In the box model, which part is the gap to other boxes? (a) margin (b) content (c) padding (d) border
- 38.🌈 Which colour is rgb(255, 0, 255)? (a) cyan (b) yellow (c) white (d) magenta
-
39.🖌️ What colour are the letters?
h1 {
background-color: orange;
color: yellow;
font-size: 16px;
text-align: center;
} (a) purple (b) yellow (c) orange -
40.🖌️ Where does the text sit on its line?
li {
font-size: 12px;
background-color: green;
color: red;
text-align: right;
} (a) in the middle (b) on the right (c) on the left
Answer key
- No
- display: flex
- 188
- makes a link
- .note
- packs boxes at the end
- red
- rounds box corners
- 16
- padding
- makes the text bold
- background-color
- True
- blue
- centres a heading
- sets the letter colour
- equal gaps, none at ends
- space-between
- center
- puts boxes in the middle
- 3
- 2
- ;
- 600px or narrower
- 330
- fits every screen
- 40
- center
- red
- yellow
- the viewport meta tag
- 70
- yellow
- puts a picture on a page
- 338
- #logo
- margin
- magenta
- yellow
- on the right
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids