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 of light is strongest in rgb(157, 56, 9)? (a) green (b) red (c) blue
- 2.🎯 Which element does the selector .note style? (a) <h2 id="note"> (b) <h2 class="note"> (c) <li class="red"> (d) <h2 class="big">
-
3.⚖️ What colour is the text of this element?
<p class="menu" id="main">Hi</p>
CSS:
p { color: blue; }
p { color: green; } (a) white (b) green (c) blue (d) purple - 4.🌈 Which colour is #00ffff? (a) cyan (b) magenta (c) white (d) yellow
- 5.💪 Which flexbox property picks row or column? (a) justify-content (b) align-items (c) flex-direction (d) display: flex
-
6.✍️ What value is given to background-color in this rule?
body {
font-size: 20px;
background-color: yellow;
} (a) background-color (b) 10px (c) yellow (d) 8px -
7.⚖️ What colour is the text of this element?
<p class="star" id="top">Hi</p>
CSS:
.star { color: orange; }
#top { color: purple; }
p { color: yellow; } (a) orange (b) yellow (c) green (d) purple -
8.✍️ What is the selector in this CSS rule?
h2 {
font-weight: bold;
text-align: center;
} (a) font-weight (b) h2 (c) center (d) h1 - 9.Which of these is the content? (a) the text or picture (b) a solid or dotted edge (c) the gap round content (d) the line round the box
-
10.🎯 Which CSS selector matches this element?
<p class="menu" id="end">Hello</p> (a) h1 (b) .end (c) .menu (d) #menu -
11.✍️ How many declarations (property: value pairs) are in this rule?
h1 {
border: 2px solid;
} -
12.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 600px) {
p {
font-size: 26px;
}
} (a) Yes (b) No - 13.🎨 Which tag connects an outside CSS file? (a) <a> (b) <css> (c) <link> (d) <img>
- 14.True or false: padding is the text or picture. (a) False (b) True
-
15.🖌️ How big is the text, in px?
h1 {
font-size: 28px;
background-color: yellow;
text-align: left;
color: white;
} -
16.⚖️ What colour is the text of this element?
<p class="box" id="end">Hi</p>
CSS:
.box { color: green; }
.box { color: blue; } (a) orange (b) blue (c) purple (d) green - 17.🖌️ Which CSS property colours behind the text? (a) text-align (b) font-family (c) background-color (d) color
-
18.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 130px;
justify-content: flex-start;
}
Inside are 2 boxes, each 40px wide (no margins). - 19.🎯 What kind of selector is .note? (a) an id selector (b) an element selector (c) a class selector
-
20.✍️ How many declarations (property: value pairs) are in this rule?
body {
font-weight: bold;
font-style: italic;
text-align: center;
background-color: yellow;
} -
21.✍️ Which property is set to 10px in this rule?
h1 {
margin: 10px;
font-size: 20px;
border: 2px solid;
} (a) padding (b) margin (c) font-weight (d) 10px -
22.🖌️ What colour are the letters?
h2 {
background-color: white;
text-align: right;
font-size: 40px;
color: orange;
} (a) white (b) black (c) orange -
23.✍️ Which property is set to 300px in this rule?
.note {
width: 300px;
font-size: 20px;
} (a) 300px (b) width (c) color (d) font-style -
24.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 150px;
justify-content: flex-start;
}
Inside are 2 boxes, each 50px wide (no margins). - 25.🔍 Which is the odd one out? (a) sets colours and fonts (b) makes a link (c) puts a picture on a page (d) gives the page structure
-
26.✍️ What value is given to background-color in this rule?
h2 {
background-color: yellow;
font-size: 20px;
color: red;
} (a) background-color (b) 8px (c) yellow (d) 10px - 27.What does font-size do? (a) picks the font style (b) centres a heading (c) makes the text bold (d) makes letters bigger
- 28.🎨 A CSS file usually ends with which extension? (a) .css (b) .png (c) .html (d) .js
-
29.✍️ What is the selector in this CSS rule?
body {
font-weight: bold;
color: red;
border: 2px solid;
} (a) .box (b) font-weight (c) red (d) body - 30.⚖️ Which selector is the strongest? (a) an id selector (b) a class selector (c) an element selector
- 31.🎯 What kind of selector is #main? (a) an element selector (b) a class selector (c) an id selector
- 32.What does justify-content: center do? (a) equal gaps, none at ends (b) puts boxes in the middle (c) packs boxes at the end (d) packs boxes at the start
- 33.🎯 Which sign starts a class selector? (a) @ (b) . (c) # (d) &
- 34.What does text-align do? (a) centres a heading (b) picks the font style (c) makes the text bold (d) makes letters bigger
- 35.🎯 Which element does the selector .box style? (a) <div id="box"> (b) <div class="star"> (c) <div class="box"> (d) <span class="menu">
-
36.✍️ Which property is set to red in this rule?
#top {
background-color: yellow;
color: red;
margin: 10px;
} (a) font-size (b) text-align (c) red (d) color -
37.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 600px) {
p {
font-size: 26px;
}
} (a) Yes (b) No - 38.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 2 (b) 3 (c) 4 (d) 6
-
39.✍️ How many declarations (property: value pairs) are in this rule?
p {
color: red;
width: 300px;
text-align: center;
padding: 8px;
} -
40.🎯 Which CSS selector matches this element?
<p class="menu" id="main">Hello</p> (a) h1 (b) #menu (c) .menu (d) .main
Answer key
- red
- <h2 class="note">
- green
- cyan
- flex-direction
- yellow
- purple
- h2
- the text or picture
- .menu
- 1
- No
- <link>
- False
- 28
- blue
- background-color
- 50
- a class selector
- 4
- margin
- orange
- width
- 50
- sets colours and fonts
- yellow
- makes letters bigger
- .css
- body
- an id selector
- an id selector
- puts boxes in the middle
- .
- centres a heading
- <div class="box">
- color
- No
- 3
- 4
- .menu
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids