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 #000021 the blue part is the hex number 21. What is it as a normal number?
- 2.📱 max-width: 600px applies when the screen is ___. (a) exactly 1000px (b) 600px or wider (c) 600px or narrower (d) turned off
- 3.✍️ In color: blue; which part is the value? (a) ; (b) color (c) : (d) blue
- 4.🌈 In #rrggbb, which colour do the first two digits give? (a) green (b) blue (c) black (d) red
- 5.✍️ Which sign goes between a property and its value? (a) ; (b) - (c) : (d) =
-
6.📱 The screen is 1100px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (min-width: 480px) {
p {
font-size: 18px;
}
} (a) Yes (b) No - 7.🎯 Which element does the selector .note style? (a) <h2 class="big"> (b) <li class="red"> (c) <h2 id="note"> (d) <h2 class="note">
- 8.🌈 Which colour is rgb(255, 255, 0)? (a) magenta (b) red (c) cyan (d) yellow
- 9.🎯 What kind of selector is .note? (a) a class selector (b) an element selector (c) an id selector
- 10.🔍 Which is the odd one out? (a) reacts to a button click (b) checks a quiz answer (c) makes a form box (d) counts down a timer
-
11.⚖️ What colour is the text of this element?
<h1 class="note" id="intro">Hi</h1>
CSS:
.note { color: black; }
h1 { color: orange; }
#intro { color: white; } (a) black (b) orange (c) yellow (d) white -
12.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 460px;
justify-content: space-between;
}
Inside are 3 boxes, each 100px wide (no margins). - 13.🌈 Which colour is rgb(255, 0, 255)? (a) black (b) bright green (c) magenta (d) cyan
-
14.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 1024px) {
p {
font-size: 26px;
}
} -
15.🎯 Which CSS selector matches this element?
<span class="big" id="main">Hello</span> (a) #big (b) .big (c) p (d) .red - 16.🌈 Which colour of light is strongest in rgb(150, 67, 63)? (a) green (b) red (c) blue
-
17.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 100px;
padding: 5px;
border: 5px solid black;
margin: 10px;
} -
18.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 440px;
justify-content: space-between;
}
Inside are 4 boxes, each 80px wide (no margins). -
19.⚖️ What colour is the text of this element?
<h1 class="red" id="main">Hi</h1>
CSS:
.red { color: green; }
.red { color: black; } (a) orange (b) black (c) green (d) red - 20.🖌️ Which CSS property makes the text bold? (a) font-size (b) background-color (c) font-weight (d) color
-
21.⚖️ What colour is the text of this element?
<p class="box" id="main">Hi</p>
CSS:
p { color: green; }
p { color: red; } (a) green (b) blue (c) red (d) orange - 22.🎯 Which element does the selector div style? (a) <span> (b) <p class="star"> (c) <div class="star"> (d) <h1 id="main">
- 23.Which of these is the border? (a) the gap to other boxes (b) the line round the box (c) space inside the border (d) the gap round content
- 24.🌈 In #00b800 the green part is the hex number b8. What is it as a normal number?
- 25.🎯 What kind of selector is #logo? (a) an id selector (b) a class selector (c) an element selector
- 26.True or false: #main is an id selector. (a) True (b) False
-
27.🖌️ What colour is behind the letters?
h2 {
text-align: right;
color: orange;
font-size: 12px;
background-color: green;
} (a) blue (b) green (c) orange - 28.⚖️ Which selector is the weakest? (a) an id selector (b) a class selector (c) an element selector
-
29.✍️ What value is given to margin in this rule?
p {
margin: 10px;
background-color: yellow;
text-align: center;
padding: 8px;
} (a) 10px (b) bold (c) margin (d) 8px -
30.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 330px;
justify-content: flex-end;
}
Inside are 4 boxes, each 80px wide (no margins). - 31.True or false: CSS reacts to a button click. (a) False (b) True
- 32.Which of these is the content? (a) a solid or dotted edge (b) the line round the box (c) the text or picture (d) space inside the border
- 33.True or false: HTML puts a picture on a page. (a) True (b) False
- 34.Which of these does JavaScript do? (a) shows a pop-up message (b) sets colours and fonts (c) puts a picture on a page (d) adds space around boxes
-
35.🎯 Which CSS selector matches this element?
<h1 class="big" id="hero">Hello</h1> (a) #big (b) .big (c) .hero (d) .red - 36.🎯 Which element does the selector .big style? (a) <span class="red"> (b) <p class="box"> (c) <span class="big"> (d) <span id="big">
- 37.🖌️ Which CSS property sets the letter colour? (a) text-align (b) font-weight (c) font-size (d) color
-
38.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 140px;
padding: 15px;
border: 4px solid black;
margin: 20px;
} - 39.📱 Responsive design means a page ___. (a) has no pictures (b) never changes (c) fits every screen (d) is only for laptops
- 40.True or false: CSS gives the page structure. (a) True (b) False
Answer key
- 33
- 600px or narrower
- blue
- red
- :
- Yes
- <h2 class="note">
- yellow
- a class selector
- makes a form box
- white
- 80
- magenta
- 24
- .big
- red
- 140
- 40
- black
- font-weight
- red
- <div class="star">
- the line round the box
- 184
- an id selector
- True
- green
- an element selector
- 10px
- 10
- False
- the text or picture
- True
- shows a pop-up message
- .big
- <span class="big">
- color
- 178
- fits every screen
- False
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids