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="big" id="logo">Hi</h1>
CSS:
.big { color: green; }
.big { color: black; } (a) white (b) blue (c) black (d) green - 2.✍️ In color: blue; which part is the value? (a) color (b) : (c) ; (d) blue
-
3.✍️ What is the selector in this CSS rule?
h1 {
font-size: 20px;
background-color: yellow;
color: red;
} (a) yellow (b) font-size (c) h1 (d) p -
4.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 230px;
padding: 5px;
border: 2px solid black;
margin: 10px;
} - 5.🌈 In #rrggbb, which colour do the first two digits give? (a) red (b) green (c) black (d) blue
-
6.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 200px;
padding: 15px;
border: 4px solid black;
margin: 0px;
} - 7.🎨 Which attribute adds CSS inside one tag? (a) alt (b) href (c) src (d) style
- 8.🌈 Which colour is rgb(255, 255, 0)? (a) yellow (b) red (c) black (d) white
- 9.📦 In the box model, which part is a solid or dotted edge? (a) padding (b) margin (c) border (d) content
-
10.✍️ What is the selector in this CSS rule?
p {
background-color: yellow;
width: 300px;
} (a) 300px (b) background-color (c) .note (d) p - 11.🎯 Which element does the selector #hero style? (a) <span class="red"> (b) <div id="hero"> (c) <div id="top"> (d) <div class="hero">
- 12.Which of these does CSS do? (a) gives the page structure (b) checks a quiz answer (c) makes headings and lists (d) lays out the page
-
13.✍️ How many declarations (property: value pairs) are in this rule?
li {
padding: 8px;
background-color: yellow;
font-size: 20px;
} - 14.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the later one (c) the shorter one (d) the first one
- 15.💪 Which justify-content value puts boxes in the middle? (a) center (b) flex-start (c) flex-end (d) space-between
-
16.📦 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: 15px;
border: 3px solid black;
margin: 15px;
} - 17.🌈 Which colour of light is strongest in rgb(173, 102, 1)? (a) red (b) green (c) blue
-
18.📱 The screen is 700px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (max-width: 768px) {
p {
font-size: 22px;
}
} (a) Yes (b) No - 19.✍️ Which sign goes between a property and its value? (a) : (b) = (c) ; (d) -
- 20.🌈 In #000097 the blue part is the hex number 97. What is it as a normal number?
-
21.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 270px;
padding: 5px;
border: 4px solid black;
margin: 20px;
} -
22.🖌️ Where does the text sit on its line?
p {
font-size: 40px;
background-color: yellow;
color: red;
text-align: right;
} (a) on the right (b) on the left (c) in the middle -
23.🎯 Which CSS selector matches this element?
<li class="box" id="main">Hello</li> (a) li (b) div (c) #logo (d) .main -
24.📱 The screen is 1100px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (min-width: 480px) {
p {
font-size: 18px;
}
} (a) Yes (b) No - 25.🖌️ Which CSS property sets the letter colour? (a) font-weight (b) color (c) background-color (d) font-size
-
26.🎯 Which CSS selector matches this element?
<p class="note" id="logo">Hello</p> (a) #note (b) .logo (c) .big (d) .note - 27.🎯 What kind of selector is .big? (a) a class selector (b) an element selector (c) an id selector
-
28.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 1024px) {
p {
font-size: 10px;
}
} -
29.✍️ How many declarations (property: value pairs) are in this rule?
body {
font-weight: bold;
} -
30.📱 The screen is 414px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 1024px) {
p {
font-size: 32px;
}
} (a) No (b) Yes - 31.🌈 Which colour is #0000ff? (a) blue (b) yellow (c) magenta (d) red
- 32.🌈 Which colour of light is strongest in rgb(78, 169, 62)? (a) green (b) red (c) blue
- 33.🔍 Which is the odd one out? (a) makes headings and lists (b) makes a link (c) makes a form box (d) sets colours and fonts
- 34.🎨 One CSS file can style how many pages? (a) only one image (b) only one word (c) no pages (d) many pages
- 35.💪 Which flexbox property spaces boxes along a row? (a) justify-content (b) display: flex (c) flex-direction (d) align-items
- 36.📱 min-width: 800px applies when the screen is ___. (a) exactly 100px (b) 800px or narrower (c) 800px or wider (d) turned off
- 37.💪 Which flexbox property picks row or column? (a) flex-direction (b) justify-content (c) align-items (d) display: flex
- 38.🎯 What kind of selector is .menu? (a) an id selector (b) a class selector (c) an element selector
- 39.True or false: the content is the text or picture. (a) False (b) True
- 40.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 2 (b) 6 (c) 3 (d) 4
Answer key
- black
- blue
- h1
- 264
- red
- 238
- style
- yellow
- border
- p
- <div id="hero">
- lays out the page
- 3
- the later one
- center
- 186
- red
- Yes
- :
- 151
- 328
- on the right
- li
- Yes
- color
- .note
- a class selector
- 10
- 1
- No
- blue
- green
- sets colours and fonts
- many pages
- justify-content
- 800px or wider
- flex-direction
- a class selector
- True
- 3
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids