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 is the selector in this CSS rule?
h2 {
font-weight: bold;
background-color: yellow;
color: red;
} (a) h1 (b) font-weight (c) h2 (d) yellow -
2.🖌️ What colour are the letters?
h2 {
text-align: right;
color: black;
font-size: 36px;
background-color: white;
} (a) black (b) white (c) yellow - 3.🧩 Which language checks a quiz answer? (a) JavaScript (b) CSS (c) HTML
- 4.🌈 Which colour is #ffff00? (a) cyan (b) white (c) yellow (d) blue
- 5.Which of these does HTML do? (a) sets colours and fonts (b) changes the page live (c) makes a form box (d) lays out the page
- 6.✍️ Which sign goes between a property and its value? (a) - (b) = (c) : (d) ;
- 7.Which of these is padding? (a) a solid or dotted edge (b) the line round the box (c) space inside the border (d) space outside the border
- 8.🎯 Which element does the selector div style? (a) <span> (b) <h1 id="main"> (c) <p class="red"> (d) <div class="red">
- 9.What does font-family do? (a) sets the letter colour (b) picks the font style (c) makes the text bold (d) centres a heading
- 10.🎯 Which element does the selector .menu style? (a) <span class="menu"> (b) <span class="note"> (c) <p class="big"> (d) <span id="menu">
- 11.🖌️ Which CSS property sets the letter colour? (a) font-size (b) font-weight (c) color (d) font-family
- 12.🌈 In #00f200 the green part is the hex number f2. What is it as a normal number?
-
13.🖌️ What colour are the letters?
p {
font-size: 12px;
text-align: center;
color: red;
background-color: purple;
} (a) purple (b) red (c) blue - 14.Which of these is the content? (a) the text or picture (b) a solid or dotted edge (c) space outside the border (d) the gap round content
- 15.⚖️ Which selector is the strongest? (a) an id selector (b) a class selector (c) an element selector
- 16.✍️ How does a CSS comment start? (a) # (b) <!-- (c) /* (d) //
- 17.💪 Which flexbox property turns on flexbox? (a) flex-direction (b) justify-content (c) display: flex (d) align-items
- 18.🎯 How many elements on a page should have the same id? (a) any number (b) 1 (c) 2 (d) 5
- 19.True or false: HTML shows a pop-up message. (a) True (b) False
- 20.🌈 Which hex code is white? (a) #ff00ff (b) #ffffff (c) #00ffff (d) #ff0000
-
21.⚖️ What colour is the text of this element?
<h2 class="red" id="intro">Hi</h2>
CSS:
#intro { color: yellow; }
.red { color: green; } (a) green (b) yellow (c) black (d) purple - 22.🌈 Which colour is rgb(0, 255, 255)? (a) white (b) black (c) cyan (d) blue
-
23.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 600px) {
p {
font-size: 30px;
}
} -
24.⚖️ What colour is the text of this element?
<h1 class="red" id="end">Hi</h1>
CSS:
#end { color: white; }
#end { color: purple; } (a) purple (b) red (c) yellow (d) white -
25.🎯 Which CSS selector matches this element?
<span class="star" id="intro">Hello</span> (a) #star (b) .menu (c) span (d) .intro -
26.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 70px;
padding: 5px;
border: 4px solid black;
margin: 5px;
} - 27.📱 What does a media query check? (a) the time of day (b) the page title (c) the screen width (d) the battery level
-
28.⚖️ What colour is the text of this element?
<h1 class="menu" id="intro">Hi</h1>
CSS:
.menu { color: red; }
.menu { color: blue; } (a) orange (b) blue (c) red (d) yellow -
29.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 180px;
justify-content: flex-end;
}
Inside are 2 boxes, each 50px wide (no margins). - 30.🌈 Which hex code is yellow? (a) #ff00ff (b) #ffff00 (c) #0000ff (d) #ff0000
- 31.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the first one (b) the shorter one (c) neither (d) the later one
- 32.🌈 What is the biggest number one colour can have in rgb()? (a) 100 (b) 255 (c) 1000 (d) 99
- 33.🔍 Which is the odd one out? (a) makes headings and lists (b) puts a picture on a page (c) makes a link (d) adds space around boxes
- 34.🧩 Which language makes a form box? (a) JavaScript (b) CSS (c) HTML
- 35.True or false: margin is space outside the border. (a) True (b) False
- 36.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 6 (b) 2 (c) 3 (d) 4
- 37.🌈 In #9e0000 the red part is the hex number 9e. What is it as a normal number?
- 38.📦 In the box model, which part is space outside the border? (a) content (b) border (c) padding (d) margin
-
39.🖌️ How big is the text, in px?
li {
text-align: right;
background-color: orange;
font-size: 32px;
color: white;
} - 40.🌈 Which colour is #00ff00? (a) cyan (b) blue (c) white (d) bright green
Answer key
- h2
- black
- JavaScript
- yellow
- makes a form box
- :
- space inside the border
- <div class="red">
- picks the font style
- <span class="menu">
- color
- 242
- red
- the text or picture
- an id selector
- /*
- display: flex
- 1
- False
- #ffffff
- yellow
- cyan
- 30
- purple
- span
- 88
- the screen width
- blue
- 80
- #ffff00
- the later one
- 255
- adds space around boxes
- HTML
- True
- 3
- 158
- margin
- 32
- bright green
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids