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?
<h1 class="menu" id="main">Hi</h1>
CSS:
#main { color: green; }
#main { color: white; } (a) green (b) orange (c) white (d) red - 2.🌈 Which colour is #ffff00? (a) bright green (b) blue (c) yellow (d) red
- 3.✍️ In color: blue; which part is the value? (a) blue (b) ; (c) : (d) color
- 4.🌈 Which colour is #00ff00? (a) bright green (b) cyan (c) red (d) yellow
- 5.🌈 In #rrggbb, which colour do the first two digits give? (a) red (b) green (c) black (d) blue
- 6.🌈 Which colour is rgb(255, 0, 255)? (a) red (b) magenta (c) yellow (d) bright green
-
7.🖌️ How big is the text, in px?
h1 {
font-size: 20px;
text-align: right;
background-color: white;
color: orange;
} -
8.🖌️ What colour are the letters?
h1 {
background-color: green;
font-size: 40px;
color: white;
text-align: right;
} (a) white (b) green (c) blue - 9.🌈 Which colour is #ff00ff? (a) magenta (b) yellow (c) white (d) cyan
-
10.🖌️ How big is the text, in px?
h1 {
background-color: blue;
color: green;
font-size: 40px;
text-align: right;
} -
11.⚖️ What colour is the text of this element?
<h1 class="star" id="hero">Hi</h1>
CSS:
h1 { color: red; }
h1 { color: green; } (a) yellow (b) green (c) red (d) white - 12.🌈 In #rrggbb, which colour do the last two digits give? (a) white (b) red (c) green (d) blue
- 13.True or false: the content is space inside the border. (a) False (b) True
- 14.🌈 Hex digits go 0 to 9, then A to which letter? (a) Z (b) F (c) G (d) J
- 15.🎯 What kind of selector is h1? (a) an id selector (b) a class selector (c) an element selector
- 16.🔍 Which is the odd one out? (a) changes the text size (b) rounds box corners (c) changes the page live (d) adds space around boxes
-
17.⚖️ What colour is the text of this element?
<h2 class="star" id="intro">Hi</h2>
CSS:
#intro { color: black; }
h2 { color: green; } (a) white (b) green (c) blue (d) black -
18.📱 The screen is 1366px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 480px) {
p {
font-size: 8px;
}
} (a) No (b) Yes - 19.True or false: the content is the gap round content. (a) True (b) False
-
20.🖌️ What colour are the letters?
li {
color: green;
font-size: 16px;
background-color: red;
text-align: right;
} (a) white (b) green (c) red -
21.✍️ How many declarations (property: value pairs) are in this rule?
h1 {
border: 2px solid;
} -
22.✍️ Which property is set to 20px in this rule?
h2 {
font-size: 20px;
border: 2px solid;
background-color: yellow;
} (a) text-align (b) 20px (c) font-size (d) background-color - 23.🎨 One CSS file can style how many pages? (a) no pages (b) only one word (c) many pages (d) only one image
- 24.🌈 Which hex code is cyan? (a) #00ff00 (b) #00ffff (c) #ff00ff (d) #000000
-
25.⚖️ What colour is the text of this element?
<h2 class="star" id="intro">Hi</h2>
CSS:
h2 { color: black; }
h2 { color: green; } (a) white (b) green (c) black (d) purple - 26.🖌️ Which CSS property centres a heading? (a) font-family (b) color (c) text-align (d) font-size
- 27.True or false: .card is a class selector. (a) False (b) True
- 28.🌈 Which hex code is black? (a) #ffff00 (b) #000000 (c) #ffffff (d) #00ffff
-
29.🖌️ What colour are the letters?
p {
background-color: green;
color: white;
font-size: 16px;
text-align: center;
} (a) green (b) white (c) blue -
30.✍️ How many declarations (property: value pairs) are in this rule?
p {
color: red;
font-style: italic;
} - 31.🌈 Which colour is #0000ff? (a) black (b) blue (c) cyan (d) yellow
- 32.True or false: the border is the line round the box. (a) False (b) True
- 33.True or false: body is an id selector. (a) False (b) True
- 34.🌈 Which colour is rgb(0, 255, 255)? (a) cyan (b) red (c) yellow (d) bright green
- 35.🎯 Can many elements share the same class? (a) No (b) Yes
- 36.🌈 In #00a300 the green part is the hex number a3. What is it as a normal number?
-
37.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 150px;
justify-content: space-between;
}
Inside are 2 boxes, each 40px wide (no margins). -
38.✍️ How many declarations (property: value pairs) are in this rule?
body {
background-color: yellow;
width: 300px;
font-size: 20px;
margin: 10px;
} -
39.🖌️ What colour are the letters?
h1 {
background-color: blue;
text-align: left;
font-size: 24px;
color: orange;
} (a) purple (b) blue (c) orange - 40.🎨 A CSS file usually ends with which extension? (a) .js (b) .png (c) .html (d) .css
Answer key
- white
- yellow
- blue
- bright green
- red
- magenta
- 20
- white
- magenta
- 40
- green
- blue
- False
- F
- an element selector
- changes the page live
- black
- No
- False
- green
- 1
- font-size
- many pages
- #00ffff
- green
- text-align
- True
- #000000
- white
- 2
- blue
- True
- False
- cyan
- Yes
- 163
- 70
- 4
- orange
- .css
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids