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 kind of selector is #logo? (a) an element selector (b) a class selector (c) an id selector
- 2.🎯 Which element does the selector .menu style? (a) <h1 id="menu"> (b) <h1 class="menu"> (c) <h1 class="note"> (d) <h2 class="big">
- 3.🎯 Can many elements share the same class? (a) Yes (b) No
-
4.🖌️ How big is the text, in px?
p {
color: green;
text-align: right;
font-size: 24px;
background-color: yellow;
} - 5.🌈 Which colour of light is strongest in rgb(52, 161, 92)? (a) red (b) green (c) blue
-
6.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 420px;
justify-content: flex-end;
}
Inside are 4 boxes, each 100px wide (no margins). - 7.🌈 Which colour is rgb(255, 255, 255)? (a) white (b) black (c) yellow (d) red
- 8.🌈 Which colour is rgb(0, 255, 0)? (a) blue (b) bright green (c) yellow (d) cyan
- 9.🔍 Which is the odd one out? (a) changes the page live (b) makes headings and lists (c) shows a pop-up message (d) reacts to a button click
-
10.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (min-width: 768px) {
p {
font-size: 28px;
}
} - 11.What does text-align do? (a) makes letters bigger (b) colours behind the text (c) sets the letter colour (d) centres a heading
-
12.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 290px;
padding: 10px;
border: 3px solid black;
margin: 20px;
} -
13.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 360px;
justify-content: center;
}
Inside are 4 boxes, each 50px wide (no margins). -
14.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (min-width: 480px) {
p {
font-size: 18px;
}
} (a) No (b) Yes - 15.🔍 Which is the odd one out? (a) gives the page structure (b) lays out the page (c) changes the text size (d) adds space around boxes
- 16.🎨 Which attribute adds CSS inside one tag? (a) style (b) alt (c) href (d) src
- 17.🎨 Which tag holds CSS inside the head? (a) <script> (b) <body> (c) <css> (d) <style>
- 18.🎨 Which tag connects an outside CSS file? (a) <css> (b) <link> (c) <img> (d) <a>
-
19.⚖️ What colour is the text of this element?
<h2 class="star" id="end">Hi</h2>
CSS:
h2 { color: red; }
.star { color: white; }
#end { color: purple; } (a) red (b) green (c) purple (d) white -
20.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 768px) {
p {
font-size: 22px;
}
} -
21.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 170px;
justify-content: flex-end;
}
Inside are 3 boxes, each 50px wide (no margins). - 22.True or false: p is an element selector. (a) True (b) False
- 23.Which of these does CSS do? (a) changes the page live (b) counts down a timer (c) gives the page structure (d) sets colours and fonts
-
24.🖌️ What colour is behind the letters?
p {
text-align: center;
color: blue;
font-size: 20px;
background-color: green;
} (a) black (b) green (c) blue - 25.🌈 Which hex code is blue? (a) #00ff00 (b) #ffffff (c) #000000 (d) #0000ff
- 26.True or false: the content is the text or picture. (a) False (b) True
- 27.📱 Which tag helps phones show a page at the right size? (a) the br tag (b) the viewport meta tag (c) the title tag (d) the hr tag
-
28.✍️ Which property is set to bold in this rule?
.note {
font-weight: bold;
font-style: italic;
} (a) width (b) bold (c) border (d) font-weight - 29.🔍 Which is the odd one out? (a) makes headings and lists (b) reacts to a button click (c) makes a link (d) gives the page structure
- 30.🌈 Which hex code is yellow? (a) #ffffff (b) #ff00ff (c) #ff0000 (d) #ffff00
-
31.⚖️ What colour is the text of this element?
<h2 class="note" id="logo">Hi</h2>
CSS:
h2 { color: black; }
#logo { color: white; }
.note { color: purple; } (a) green (b) purple (c) white (d) black -
32.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 768px) {
p {
font-size: 18px;
}
} -
33.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 580px;
justify-content: space-between;
}
Inside are 4 boxes, each 100px wide (no margins). - 34.Which of these does HTML do? (a) makes a form box (b) checks a quiz answer (c) lays out the page (d) shows a pop-up message
- 35.What does font-family do? (a) sets the letter colour (b) colours behind the text (c) picks the font style (d) makes letters bigger
- 36.🖌️ Which CSS property sets the letter colour? (a) font-size (b) color (c) background-color (d) font-family
- 37.🎯 What kind of selector is li? (a) a class selector (b) an id selector (c) an element selector
- 38.🌈 In #000030 the blue part is the hex number 30. What is it as a normal number?
- 39.⚖️ Which selector is the weakest? (a) an id selector (b) an element selector (c) a class selector
- 40.📱 What does a media query check? (a) the screen width (b) the time of day (c) the battery level (d) the page title
Answer key
- an id selector
- <h1 class="menu">
- Yes
- 24
- green
- 20
- white
- bright green
- makes headings and lists
- 20
- centres a heading
- 316
- 80
- No
- gives the page structure
- style
- <style>
- <link>
- purple
- 16
- 20
- True
- sets colours and fonts
- green
- #0000ff
- True
- the viewport meta tag
- font-weight
- reacts to a button click
- #ffff00
- white
- 16
- 60
- makes a form box
- picks the font style
- color
- an element selector
- 48
- an element selector
- the screen width
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids