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.Which of these is padding? (a) the gap to other boxes (b) a solid or dotted edge (c) the gap round content (d) the line round the box
- 2.🌈 In #000b00 the green part is the hex number 0b. What is it as a normal number?
- 3.📱 Responsive design means a page ___. (a) is only for laptops (b) never changes (c) has no pictures (d) fits every screen
- 4.🎯 What kind of selector is .big? (a) an id selector (b) an element selector (c) a class selector
-
5.🎯 Which CSS selector matches this element?
<h1 class="big" id="main">Hello</h1> (a) #big (b) .main (c) #logo (d) h1 - 6.📱 max-width: 600px applies when the screen is ___. (a) 600px or narrower (b) turned off (c) 600px or wider (d) exactly 1000px
- 7.True or false: margin is space inside the border. (a) True (b) False
- 8.📦 In the box model, which part is space inside the border? (a) content (b) padding (c) border (d) margin
-
9.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 480px) {
p {
font-size: 14px;
}
} - 10.🌈 Which colour is rgb(0, 0, 255)? (a) blue (b) white (c) cyan (d) magenta
-
11.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 410px;
justify-content: space-between;
}
Inside are 4 boxes, each 80px wide (no margins). -
12.📱 The screen is 700px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (min-width: 600px) {
p {
font-size: 16px;
}
} (a) No (b) Yes - 13.🎯 Which element does the selector #hero style? (a) <span class="hero"> (b) <span id="top"> (c) <p class="red"> (d) <span id="hero">
- 14.Which of these does JavaScript do? (a) adds space around boxes (b) reacts to a button click (c) changes the text size (d) puts a picture on a page
- 15.⚖️ Which selector is the weakest? (a) a class selector (b) an element selector (c) an id selector
-
16.⚖️ What colour is the text of this element?
<h2 class="star" id="hero">Hi</h2>
CSS:
h2 { color: purple; }
#hero { color: green; }
.star { color: yellow; } (a) green (b) red (c) yellow (d) purple -
17.⚖️ What colour is the text of this element?
<h2 class="menu" id="top">Hi</h2>
CSS:
h2 { color: red; }
h2 { color: green; } (a) yellow (b) black (c) green (d) red - 18.⚖️ Which selector is the strongest? (a) an element selector (b) an id selector (c) a class selector
- 19.🖌️ Which CSS property colours behind the text? (a) color (b) font-weight (c) text-align (d) background-color
-
20.🖌️ What colour is behind the letters?
h1 {
background-color: purple;
font-size: 20px;
text-align: center;
color: green;
} (a) white (b) purple (c) green - 21.True or false: HTML makes a form box. (a) True (b) False
- 22.True or false: padding is space inside the border. (a) False (b) True
-
23.📱 The screen is 1366px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (min-width: 480px) {
p {
font-size: 24px;
}
} (a) Yes (b) No -
24.✍️ What value is given to font-style in this rule?
.note {
font-style: italic;
font-size: 20px;
} (a) font-style (b) 20px (c) red (d) italic - 25.🎯 Which element does the selector .big style? (a) <li class="big"> (b) <li class="red"> (c) <div class="box"> (d) <li id="big">
- 26.✍️ CSS declarations go inside which brackets? (a) < > (b) ( ) (c) [ ] (d) { }
-
27.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 1024px) {
p {
font-size: 12px;
}
} (a) Yes (b) No -
28.⚖️ What colour is the text of this element?
<p class="menu" id="end">Hi</p>
CSS:
.menu { color: yellow; }
.menu { color: blue; } (a) blue (b) yellow (c) green (d) red -
29.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 200px;
padding: 30px;
border: 5px solid black;
margin: 20px;
} - 30.🌈 In #bf0000 the red part is the hex number bf. What is it as a normal number?
-
31.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 220px;
justify-content: flex-start;
}
Inside are 2 boxes, each 80px wide (no margins). - 32.🌈 In #rrggbb, which colour do the first two digits give? (a) green (b) black (c) blue (d) red
-
33.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 150px;
justify-content: flex-end;
}
Inside are 2 boxes, each 40px wide (no margins). -
34.✍️ How many declarations (property: value pairs) are in this rule?
.box {
font-weight: bold;
} - 35.✍️ Which sign ends each CSS declaration? (a) : (b) , (c) . (d) ;
-
36.🎯 Which CSS selector matches this element?
<span class="big" id="intro">Hello</span> (a) #big (b) .red (c) .big (d) .intro - 37.🎯 Which sign starts a class selector? (a) . (b) # (c) & (d) @
- 38.💪 Which justify-content value equal gaps, none at ends? (a) flex-end (b) flex-start (c) center (d) space-between
-
39.✍️ How many declarations (property: value pairs) are in this rule?
li {
width: 300px;
background-color: yellow;
} -
40.⚖️ What colour is the text of this element?
<h2 class="note" id="logo">Hi</h2>
CSS:
h2 { color: orange; }
h2 { color: red; } (a) orange (b) red (c) white (d) blue
Answer key
- the gap round content
- 11
- fits every screen
- a class selector
- h1
- 600px or narrower
- False
- padding
- 16
- blue
- 30
- Yes
- <span id="hero">
- reacts to a button click
- an element selector
- green
- green
- an id selector
- background-color
- purple
- True
- True
- Yes
- italic
- <li class="big">
- { }
- Yes
- blue
- 270
- 191
- 60
- red
- 70
- 1
- ;
- .big
- .
- space-between
- 2
- red
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids