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 colour is #ffff00? (a) white (b) yellow (c) red (d) magenta
-
2.⚖️ What colour is the text of this element?
<h2 class="star" id="main">Hi</h2>
CSS:
.star { color: green; }
.star { color: white; } (a) blue (b) orange (c) white (d) green -
3.✍️ Which property is set to 10px in this rule?
#top {
margin: 10px;
color: red;
font-size: 20px;
padding: 8px;
} (a) 10px (b) padding (c) font-weight (d) margin - 4.📱 max-width: 600px applies when the screen is ___. (a) 600px or narrower (b) 600px or wider (c) turned off (d) exactly 1000px
- 5.🌈 In #002500 the green part is the hex number 25. What is it as a normal number?
- 6.🌈 Which colour is #ff00ff? (a) red (b) black (c) magenta (d) yellow
-
7.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 200px;
justify-content: flex-start;
}
Inside are 2 boxes, each 60px wide (no margins). -
8.⚖️ What colour is the text of this element?
<h1 class="box" id="end">Hi</h1>
CSS:
#end { color: blue; }
#end { color: purple; } (a) white (b) purple (c) blue (d) orange - 9.What does justify-content: space-between do? (a) packs boxes at the start (b) puts boxes in the middle (c) equal gaps, none at ends (d) packs boxes at the end
-
10.🖌️ Where does the text sit on its line?
h1 {
color: red;
font-size: 12px;
text-align: right;
background-color: green;
} (a) on the right (b) on the left (c) in the middle -
11.🖌️ What colour is behind the letters?
li {
text-align: left;
background-color: purple;
color: blue;
font-size: 16px;
} (a) purple (b) blue (c) white - 12.🎯 What kind of selector is .big? (a) a class selector (b) an element selector (c) an id selector
- 13.🎯 Which element does the selector #top style? (a) <h1 class="top"> (b) <h1 id="top"> (c) <h1 id="intro"> (d) <h2 class="menu">
- 14.🎨 One CSS file can style how many pages? (a) many pages (b) no pages (c) only one image (d) only one word
-
15.✍️ Which property is set to 20px in this rule?
h1 {
padding: 8px;
font-size: 20px;
} (a) background-color (b) font-size (c) 20px (d) text-align - 16.True or false: CSS puts a picture on a page. (a) False (b) True
- 17.What does font-family do? (a) centres a heading (b) sets the letter colour (c) picks the font style (d) makes the text bold
-
18.✍️ What is the selector in this CSS rule?
#top {
padding: 8px;
font-size: 20px;
} (a) li (b) padding (c) #top (d) 20px -
19.⚖️ What colour is the text of this element?
<p class="menu" id="top">Hi</p>
CSS:
#top { color: black; }
#top { color: green; } (a) blue (b) green (c) black (d) orange - 20.✍️ How does a CSS comment start? (a) /* (b) // (c) <!-- (d) #
-
21.🎯 Which CSS selector matches this element?
<h1 class="star" id="intro">Hello</h1> (a) .intro (b) #star (c) #main (d) .star -
22.🖌️ What colour are the letters?
p {
background-color: blue;
font-size: 12px;
text-align: center;
color: orange;
} (a) blue (b) orange (c) green - 23.Which of these does JavaScript do? (a) makes headings and lists (b) puts a picture on a page (c) makes a form box (d) shows a pop-up message
- 24.🌈 Which colour is rgb(0, 255, 255)? (a) magenta (b) bright green (c) cyan (d) red
- 25.🎯 Which element does the selector #intro style? (a) <span class="menu"> (b) <div class="intro"> (c) <div id="main"> (d) <div id="intro">
-
26.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 480px) {
p {
font-size: 16px;
}
} -
27.📱 The screen is 414px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 1024px) {
p {
font-size: 6px;
}
} (a) Yes (b) No - 28.🌈 In #006400 the green part is the hex number 64. What is it as a normal number?
- 29.🎯 Can many elements share the same class? (a) No (b) Yes
-
30.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 230px;
padding: 5px;
border: 1px solid black;
margin: 0px;
} - 31.🌈 In #0000ce the blue part is the hex number ce. What is it as a normal number?
- 32.🌈 Which colour is rgb(0, 255, 0)? (a) magenta (b) bright green (c) yellow (d) blue
- 33.🎨 Which tag connects an outside CSS file? (a) <a> (b) <css> (c) <img> (d) <link>
-
34.📱 The screen is 820px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (min-width: 480px) {
p {
font-size: 24px;
}
} (a) Yes (b) No -
35.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 180px;
justify-content: flex-end;
}
Inside are 3 boxes, each 50px wide (no margins). - 36.🔍 Which is the odd one out? (a) makes a form box (b) makes a link (c) puts a picture on a page (d) adds space around boxes
-
37.✍️ Which property is set to bold in this rule?
p {
background-color: yellow;
font-weight: bold;
font-style: italic;
width: 300px;
} (a) font-weight (b) width (c) bold (d) border - 38.✍️ In color: blue; which part is the property? (a) color (b) blue (c) : (d) ;
-
39.⚖️ What colour is the text of this element?
<h1 class="note" id="intro">Hi</h1>
CSS:
#intro { color: red; }
#intro { color: yellow; } (a) purple (b) orange (c) red (d) yellow - 40.🎨 Which attribute adds CSS inside one tag? (a) href (b) alt (c) src (d) style
Answer key
- yellow
- white
- margin
- 600px or narrower
- 37
- magenta
- 80
- purple
- equal gaps, none at ends
- on the right
- purple
- a class selector
- <h1 id="top">
- many pages
- font-size
- False
- picks the font style
- #top
- green
- /*
- .star
- orange
- shows a pop-up message
- cyan
- <div id="intro">
- 20
- Yes
- 100
- Yes
- 242
- 206
- bright green
- <link>
- Yes
- 30
- adds space around boxes
- font-weight
- color
- yellow
- style
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids