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.🌈 In #00e400 the green part is the hex number e4. What is it as a normal number?
-
2.⚖️ What colour is the text of this element?
<h2 class="star" id="logo">Hi</h2>
CSS:
h2 { color: black; }
h2 { color: white; } (a) orange (b) white (c) black (d) red -
3.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 170px;
justify-content: flex-start;
}
Inside are 3 boxes, each 50px wide (no margins). - 4.🎨 Which attribute adds CSS inside one tag? (a) style (b) href (c) alt (d) src
-
5.✍️ How many declarations (property: value pairs) are in this rule?
body {
font-size: 20px;
border: 2px solid;
font-weight: bold;
} - 6.🌈 Which colour is #0000ff? (a) bright green (b) black (c) red (d) blue
-
7.🎯 Which CSS selector matches this element?
<div class="star" id="end">Hello</div> (a) .end (b) .star (c) span (d) #star - 8.📱 Which tag helps phones show a page at the right size? (a) the title tag (b) the br tag (c) the hr tag (d) the viewport meta tag
- 9.🔍 Which is the odd one out? (a) puts a picture on a page (b) rounds box corners (c) adds space around boxes (d) lays out the page
- 10.🎯 Which element does the selector #intro style? (a) <li class="intro"> (b) <li id="intro"> (c) <div class="star"> (d) <li id="main">
- 11.💪 Which flexbox property spaces boxes along a row? (a) justify-content (b) display: flex (c) flex-direction (d) gap
-
12.🎯 Which CSS selector matches this element?
<li class="star" id="logo">Hello</li> (a) #star (b) #end (c) .logo (d) .star - 13.🌈 Hex digits go 0 to 9, then A to which letter? (a) Z (b) F (c) J (d) G
- 14.🌈 In #rrggbb, which colour do the first two digits give? (a) green (b) red (c) blue (d) black
-
15.✍️ Which property is set to red in this rule?
.note {
margin: 10px;
color: red;
padding: 8px;
} (a) color (b) font-size (c) red (d) text-align - 16.🎨 What does CSS stand for? (a) Creative Sheet System (b) Colourful Site Styles (c) Computer Style Sheets (d) Cascading Style Sheets
- 17.Which of these does JavaScript do? (a) puts a picture on a page (b) gives the page structure (c) changes the page live (d) rounds box corners
-
18.⚖️ What colour is the text of this element?
<h1 class="star" id="main">Hi</h1>
CSS:
h1 { color: orange; }
h1 { color: green; } (a) green (b) orange (c) red (d) black -
19.🎯 Which CSS selector matches this element?
<div class="big" id="main">Hello</div> (a) span (b) .big (c) .main (d) .red - 20.True or false: .menu is a class selector. (a) False (b) True
- 21.🌈 Which colour is #00ffff? (a) magenta (b) blue (c) yellow (d) cyan
-
22.🎯 Which CSS selector matches this element?
<p class="star" id="intro">Hello</p> (a) #star (b) .intro (c) .menu (d) p - 23.✍️ Which sign ends each CSS declaration? (a) ; (b) . (c) , (d) :
-
24.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 220px;
justify-content: space-between;
}
Inside are 2 boxes, each 80px wide (no margins). - 25.📦 In the box model, which part is space inside the border? (a) border (b) content (c) margin (d) padding
-
26.📱 The screen is 700px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (max-width: 600px) {
p {
font-size: 18px;
}
} (a) Yes (b) No -
27.✍️ How many declarations (property: value pairs) are in this rule?
.note {
color: red;
font-size: 20px;
} - 28.🎯 What kind of selector is h1? (a) a class selector (b) an id selector (c) an element selector
- 29.🔍 Which is the odd one out? (a) changes the text size (b) makes a link (c) adds space around boxes (d) rounds box corners
-
30.🖌️ What colour is behind the letters?
p {
background-color: black;
text-align: right;
font-size: 24px;
color: purple;
} (a) black (b) purple (c) green -
31.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 150px;
padding: 10px;
border: 1px solid black;
margin: 20px;
} - 32.True or false: margin is the line round the box. (a) False (b) True
- 33.⚖️ Which selector is the weakest? (a) a class selector (b) an id selector (c) an element selector
- 34.⚖️ Which selector is the strongest? (a) a class selector (b) an id selector (c) an element selector
-
35.✍️ How many declarations (property: value pairs) are in this rule?
.note {
font-style: italic;
} - 36.🌈 Which colour is rgb(255, 255, 0)? (a) bright green (b) blue (c) cyan (d) yellow
- 37.💪 Which justify-content value packs boxes at the end? (a) center (b) flex-end (c) space-between (d) flex-start
- 38.🌈 In #003c00 the green part is the hex number 3c. What is it as a normal number?
-
39.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 130px;
justify-content: flex-end;
}
Inside are 2 boxes, each 40px wide (no margins). - 40.🌈 Which hex code is bright green? (a) #000000 (b) #0000ff (c) #00ff00 (d) #00ffff
Answer key
- 228
- white
- 20
- style
- 3
- blue
- .star
- the viewport meta tag
- puts a picture on a page
- <li id="intro">
- justify-content
- .star
- F
- red
- color
- Cascading Style Sheets
- changes the page live
- green
- .big
- True
- cyan
- p
- ;
- 60
- padding
- No
- 2
- an element selector
- makes a link
- black
- 172
- False
- an element selector
- an id selector
- 1
- yellow
- flex-end
- 60
- 50
- #00ff00
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids