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 CSS property picks the font style? (a) font-family (b) font-size (c) color (d) text-align
-
2.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 768px) {
p {
font-size: 12px;
}
} - 3.🌈 Which colour is #00ff00? (a) magenta (b) cyan (c) red (d) bright green
- 4.What does font-weight do? (a) makes the text bold (b) picks the font style (c) sets the letter colour (d) makes letters bigger
-
5.🖌️ What colour are the letters?
p {
font-size: 32px;
text-align: left;
background-color: orange;
color: purple;
} (a) orange (b) purple (c) yellow - 6.🎯 Can many elements share the same class? (a) Yes (b) No
- 7.💪 Which justify-content value packs boxes at the start? (a) center (b) flex-start (c) space-between (d) flex-end
- 8.🔍 Which is the odd one out? (a) rounds box corners (b) makes headings and lists (c) makes a link (d) gives the page structure
- 9.🔍 Which is the odd one out? (a) makes a link (b) adds space around boxes (c) rounds box corners (d) sets colours and fonts
- 10.⚖️ Which selector is the strongest? (a) an id selector (b) a class selector (c) an element selector
- 11.🌈 Which hex code is white? (a) #ff00ff (b) #ff0000 (c) #000000 (d) #ffffff
- 12.🎨 Which tag holds CSS inside the head? (a) <css> (b) <body> (c) <script> (d) <style>
- 13.🌈 Which colour of light is strongest in rgb(191, 136, 103)? (a) green (b) red (c) blue
-
14.⚖️ What colour is the text of this element?
<h1 class="menu" id="end">Hi</h1>
CSS:
#end { color: yellow; }
#end { color: red; } (a) yellow (b) white (c) green (d) red - 15.🎯 Which element does the selector div style? (a) <p class="big"> (b) <h1 id="intro"> (c) <div class="big"> (d) <span>
- 16.🎯 Which element does the selector #top style? (a) <p class="top"> (b) <h1 class="star"> (c) <p id="intro"> (d) <p id="top">
-
17.📱 The screen is 414px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 768px) {
p {
font-size: 10px;
}
} (a) Yes (b) No -
18.🎯 Which CSS selector matches this element?
<h2 class="big" id="logo">Hello</h2> (a) #big (b) li (c) #end (d) h2 - 19.🎯 Which element does the selector #intro style? (a) <span class="intro"> (b) <span id="main"> (c) <span id="intro"> (d) <p class="menu">
- 20.What does color do? (a) makes the text bold (b) sets the letter colour (c) makes letters bigger (d) centres a heading
-
21.🖌️ What colour is behind the letters?
h2 {
background-color: white;
text-align: center;
font-size: 24px;
color: green;
} (a) white (b) green (c) red - 22.✍️ Which sign goes between a property and its value? (a) - (b) ; (c) = (d) :
-
23.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 260px;
justify-content: flex-end;
}
Inside are 4 boxes, each 50px wide (no margins). - 24.📦 In the box model, which part is the gap to other boxes? (a) content (b) padding (c) border (d) margin
- 25.🌈 Which colour of light is strongest in rgb(191, 130, 74)? (a) green (b) red (c) blue
-
26.✍️ Which property is set to 20px in this rule?
p {
font-size: 20px;
border: 2px solid;
} (a) background-color (b) font-size (c) text-align (d) 20px -
27.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (max-width: 768px) {
p {
font-size: 14px;
}
} (a) No (b) Yes -
28.🖌️ Where does the text sit on its line?
h2 {
text-align: center;
font-size: 40px;
color: purple;
background-color: black;
} (a) in the middle (b) on the right (c) on the left - 29.True or false: p is a class selector. (a) True (b) False
- 30.🎯 What kind of selector is #main? (a) an element selector (b) an id selector (c) a class selector
-
31.✍️ What value is given to background-color in this rule?
h1 {
background-color: yellow;
font-style: italic;
font-size: 20px;
} (a) 8px (b) yellow (c) background-color (d) 10px -
32.⚖️ What colour is the text of this element?
<p class="box" id="hero">Hi</p>
CSS:
.box { color: purple; }
p { color: white; } (a) purple (b) green (c) white (d) red -
33.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 130px;
padding: 25px;
border: 3px solid black;
margin: 15px;
} -
34.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 210px;
padding: 5px;
border: 4px solid black;
margin: 15px;
} -
35.✍️ What value is given to padding in this rule?
p {
padding: 8px;
border: 2px solid;
text-align: center;
} (a) bold (b) padding (c) 8px (d) 2px solid -
36.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 180px;
padding: 10px;
border: 3px solid black;
margin: 20px;
} - 37.What does justify-content: flex-start do? (a) packs boxes at the start (b) puts boxes in the middle (c) packs boxes at the end (d) equal gaps, none at ends
- 38.🧩 Which language puts a picture on a page? (a) HTML (b) CSS (c) JavaScript
- 39.📦 In the box model, which part is the gap round content? (a) margin (b) border (c) padding (d) content
-
40.🖌️ How big is the text, in px?
h2 {
text-align: left;
color: purple;
font-size: 28px;
background-color: black;
}
Answer key
- font-family
- 16
- bright green
- makes the text bold
- purple
- Yes
- flex-start
- rounds box corners
- makes a link
- an id selector
- #ffffff
- <style>
- red
- red
- <div class="big">
- <p id="top">
- Yes
- h2
- <span id="intro">
- sets the letter colour
- white
- :
- 60
- margin
- red
- font-size
- Yes
- in the middle
- False
- an id selector
- yellow
- purple
- 216
- 258
- 8px
- 246
- packs boxes at the start
- HTML
- padding
- 28
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids