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.✍️ Which sign goes between a property and its value? (a) ; (b) - (c) = (d) :
-
2.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 530px;
justify-content: space-between;
}
Inside are 4 boxes, each 80px wide (no margins). - 3.🌈 Which colour is #000000? (a) white (b) magenta (c) blue (d) black
- 4.🌈 In #0000bc the blue part is the hex number bc. What is it as a normal number?
- 5.🖌️ Which CSS property makes the text bold? (a) background-color (b) font-size (c) font-weight (d) font-family
- 6.True or false: the border is the line round the box. (a) False (b) True
- 7.🎨 One CSS file can style how many pages? (a) only one word (b) no pages (c) only one image (d) many pages
- 8.🎯 Which element does the selector #main style? (a) <span class="red"> (b) <div id="logo"> (c) <div id="main"> (d) <div class="main">
-
9.✍️ How many declarations (property: value pairs) are in this rule?
li {
color: red;
background-color: yellow;
font-style: italic;
} - 10.Which of these is the border? (a) the gap round content (b) space outside the border (c) the text or picture (d) the line round the box
- 11.🎨 A CSS file usually ends with which extension? (a) .html (b) .png (c) .css (d) .js
- 12.📱 What does a media query check? (a) the battery level (b) the page title (c) the time of day (d) the screen width
- 13.🖌️ Which CSS property colours behind the text? (a) font-weight (b) font-size (c) color (d) background-color
- 14.Which of these is the border? (a) the gap to other boxes (b) space inside the border (c) a solid or dotted edge (d) the gap round content
- 15.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) turned off (c) exactly 100px (d) 800px or wider
- 16.🎯 What kind of selector is #hero? (a) a class selector (b) an id selector (c) an element selector
-
17.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 200px;
justify-content: flex-start;
}
Inside are 4 boxes, each 40px wide (no margins). - 18.🌈 Which colour is #ffff00? (a) blue (b) magenta (c) bright green (d) yellow
- 19.💪 Which flexbox property lines boxes up across? (a) gap (b) flex-direction (c) justify-content (d) align-items
- 20.📱 Responsive design means a page ___. (a) has no pictures (b) never changes (c) is only for laptops (d) fits every screen
-
21.⚖️ What colour is the text of this element?
<h2 class="note" id="end">Hi</h2>
CSS:
.note { color: blue; }
.note { color: green; } (a) purple (b) green (c) blue (d) black - 22.Which of these does CSS do? (a) puts a picture on a page (b) counts down a timer (c) rounds box corners (d) gives the page structure
- 23.What does font-family do? (a) makes the text bold (b) colours behind the text (c) centres a heading (d) picks the font style
- 24.What does justify-content: flex-end do? (a) packs boxes at the end (b) equal gaps, none at ends (c) puts boxes in the middle (d) packs boxes at the start
- 25.🌈 In #rrggbb, which colour do the last two digits give? (a) green (b) red (c) blue (d) white
-
26.✍️ What is the selector in this CSS rule?
.note {
font-size: 20px;
padding: 8px;
} (a) .note (b) 8px (c) font-size (d) #top - 27.💪 Which justify-content value puts boxes in the middle? (a) space-between (b) flex-end (c) center (d) flex-start
-
28.🖌️ What colour are the letters?
p {
background-color: red;
text-align: center;
color: orange;
font-size: 20px;
} (a) blue (b) red (c) orange - 29.Which of these does CSS do? (a) reacts to a button click (b) sets colours and fonts (c) gives the page structure (d) checks a quiz answer
-
30.🖌️ What colour is behind the letters?
h2 {
text-align: right;
font-size: 16px;
background-color: red;
color: blue;
} (a) blue (b) white (c) red - 31.True or false: padding is the gap round content. (a) True (b) False
- 32.True or false: HTML makes a form box. (a) False (b) True
-
33.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (min-width: 1024px) {
p {
font-size: 28px;
}
} -
34.✍️ Which property is set to 300px in this rule?
#top {
width: 300px;
background-color: yellow;
} (a) width (b) font-style (c) color (d) 300px - 35.🎯 Which sign starts an id selector? (a) & (b) @ (c) # (d) .
-
36.⚖️ What colour is the text of this element?
<h2 class="big" id="end">Hi</h2>
CSS:
#end { color: purple; }
h2 { color: white; }
.big { color: green; } (a) green (b) red (c) purple (d) white - 37.🎯 Which element does the selector #intro style? (a) <h2 id="intro"> (b) <h2 id="main"> (c) <li class="menu"> (d) <h2 class="intro">
-
38.✍️ How many declarations (property: value pairs) are in this rule?
.box {
font-size: 20px;
width: 300px;
background-color: yellow;
margin: 10px;
} - 39.True or false: img is an element selector. (a) False (b) True
- 40.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 3 (b) 4 (c) 6 (d) 2
Answer key
- :
- 70
- black
- 188
- font-weight
- True
- many pages
- <div id="main">
- 3
- the line round the box
- .css
- the screen width
- background-color
- a solid or dotted edge
- 800px or wider
- an id selector
- 40
- yellow
- align-items
- fits every screen
- green
- rounds box corners
- picks the font style
- packs boxes at the end
- blue
- .note
- center
- orange
- sets colours and fonts
- red
- True
- True
- 20
- width
- #
- purple
- <h2 id="intro">
- 4
- True
- 3
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids