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 colour is the text of this element?
<p class="big" id="main">Hi</p>
CSS:
#main { color: orange; }
#main { color: purple; } (a) purple (b) red (c) orange (d) black - 2.🎯 Which sign starts an id selector? (a) @ (b) . (c) # (d) &
- 3.🌈 Which colour is #ffffff? (a) cyan (b) magenta (c) white (d) bright green
- 4.Which of these does HTML do? (a) makes headings and lists (b) shows a pop-up message (c) counts down a timer (d) changes the text size
- 5.Which of these does HTML do? (a) checks a quiz answer (b) changes the text size (c) sets colours and fonts (d) makes a link
-
6.✍️ What is the selector in this CSS rule?
p {
background-color: yellow;
font-size: 20px;
font-weight: bold;
text-align: center;
} (a) p (b) 20px (c) .note (d) background-color - 7.🔍 Which is the odd one out? (a) rounds box corners (b) counts down a timer (c) lays out the page (d) adds space around boxes
-
8.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 110px;
padding: 5px;
border: 2px solid black;
margin: 15px;
} -
9.🖌️ How big is the text, in px?
li {
background-color: yellow;
text-align: left;
color: red;
font-size: 24px;
} - 10.True or false: HTML makes a form box. (a) False (b) True
-
11.⚖️ What colour is the text of this element?
<p class="red" id="main">Hi</p>
CSS:
.red { color: red; }
.red { color: green; } (a) blue (b) black (c) green (d) red - 12.🎨 Which tag connects an outside CSS file? (a) <link> (b) <img> (c) <a> (d) <css>
-
13.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 150px;
justify-content: flex-end;
}
Inside are 2 boxes, each 60px wide (no margins). - 14.📱 min-width: 800px applies when the screen is ___. (a) exactly 100px (b) 800px or narrower (c) 800px or wider (d) turned off
- 15.🌈 Which colour is rgb(255, 0, 0)? (a) bright green (b) magenta (c) red (d) black
-
16.✍️ What is the selector in this CSS rule?
#top {
margin: 10px;
background-color: yellow;
font-style: italic;
padding: 8px;
} (a) yellow (b) margin (c) #top (d) li - 17.True or false: CSS makes a link. (a) True (b) False
- 18.💪 Which justify-content value puts boxes in the middle? (a) flex-start (b) space-between (c) center (d) flex-end
- 19.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) the first one (c) the later one (d) neither
- 20.🎯 What kind of selector is .star? (a) an element selector (b) an id selector (c) a class selector
- 21.⚖️ Which selector is the weakest? (a) an id selector (b) an element selector (c) a class selector
-
22.✍️ Which property is set to 300px in this rule?
p {
width: 300px;
color: red;
margin: 10px;
padding: 8px;
} (a) width (b) color (c) font-style (d) 300px - 23.Which of these does HTML do? (a) changes the text size (b) checks a quiz answer (c) puts a picture on a page (d) shows a pop-up message
-
24.🖌️ What colour is behind the letters?
p {
background-color: red;
color: orange;
text-align: left;
font-size: 24px;
} (a) red (b) orange (c) blue - 25.🎯 What kind of selector is #hero? (a) an id selector (b) an element selector (c) a class selector
- 26.🌈 Hex digits go 0 to 9, then A to which letter? (a) J (b) F (c) G (d) Z
-
27.⚖️ What colour is the text of this element?
<h2 class="star" id="logo">Hi</h2>
CSS:
#logo { color: green; }
#logo { color: white; } (a) green (b) yellow (c) red (d) white - 28.📱 Responsive design means a page ___. (a) fits every screen (b) has no pictures (c) never changes (d) is only for laptops
- 29.📦 In the box model, which part is the text or picture? (a) border (b) content (c) padding (d) margin
-
30.⚖️ What colour is the text of this element?
<h1 class="red" id="intro">Hi</h1>
CSS:
h1 { color: red; }
h1 { color: purple; } (a) blue (b) purple (c) red (d) orange -
31.🖌️ How big is the text, in px?
h2 {
color: green;
text-align: center;
font-size: 36px;
background-color: blue;
} - 32.🔍 Which is the odd one out? (a) changes the text size (b) gives the page structure (c) puts a picture on a page (d) makes headings and lists
-
33.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 200px;
justify-content: flex-start;
}
Inside are 3 boxes, each 60px wide (no margins). -
34.✍️ What value is given to color in this rule?
body {
background-color: yellow;
color: red;
font-style: italic;
} (a) 20px (b) center (c) red (d) color -
35.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 240px;
justify-content: flex-end;
}
Inside are 4 boxes, each 50px wide (no margins). - 36.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 2 (b) 3 (c) 4 (d) 6
- 37.📱 What does a media query check? (a) the battery level (b) the screen width (c) the page title (d) the time of day
-
38.✍️ What value is given to font-size in this rule?
h2 {
color: red;
font-size: 20px;
width: 300px;
} (a) font-size (b) yellow (c) center (d) 20px - 39.🎯 What kind of selector is p? (a) a class selector (b) an id selector (c) an element selector
- 40.🌈 In #rrggbb, which colour do the last two digits give? (a) blue (b) green (c) white (d) red
Answer key
- purple
- #
- white
- makes headings and lists
- makes a link
- p
- counts down a timer
- 124
- 24
- True
- green
- <link>
- 30
- 800px or wider
- red
- #top
- False
- center
- the later one
- a class selector
- an element selector
- width
- puts a picture on a page
- red
- an id selector
- F
- white
- fits every screen
- content
- purple
- 36
- changes the text size
- 20
- red
- 40
- 3
- the screen width
- 20px
- an element selector
- blue
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids