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 property is set to italic in this rule?
#top {
font-style: italic;
font-weight: bold;
text-align: center;
} (a) italic (b) font-style (c) color (d) font-size - 2.Which of these does HTML do? (a) lays out the page (b) checks a quiz answer (c) rounds box corners (d) makes a form box
-
3.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 110px;
padding: 5px;
border: 5px solid black;
margin: 10px;
} -
4.🎯 Which CSS selector matches this element?
<li class="menu" id="hero">Hello</li> (a) .hero (b) #menu (c) .menu (d) #top -
5.✍️ How many declarations (property: value pairs) are in this rule?
h2 {
margin: 10px;
font-weight: bold;
} -
6.🖌️ Where does the text sit on its line?
h1 {
color: purple;
background-color: green;
text-align: left;
font-size: 16px;
} (a) on the right (b) on the left (c) in the middle - 7.🎯 What kind of selector is .big? (a) an id selector (b) a class selector (c) an element selector
-
8.🖌️ Where does the text sit on its line?
h2 {
font-size: 12px;
color: blue;
text-align: left;
background-color: white;
} (a) on the left (b) on the right (c) in the middle - 9.🎯 Which element does the selector h2 style? (a) <span id="hero"> (b) <li> (c) <div class="red"> (d) <h2 class="red">
-
10.✍️ What value is given to width in this rule?
.note {
padding: 8px;
width: 300px;
} (a) 300px (b) width (c) italic (d) red -
11.🖌️ What colour is behind the letters?
h1 {
color: yellow;
font-size: 40px;
text-align: center;
background-color: white;
} (a) yellow (b) red (c) white -
12.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 400px;
justify-content: center;
}
Inside are 3 boxes, each 80px wide (no margins). - 13.📦 In the box model, which part is the gap to other boxes? (a) content (b) padding (c) border (d) margin
-
14.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 480px) {
p {
font-size: 20px;
}
} -
15.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 480px) {
p {
font-size: 8px;
}
} - 16.🎯 Which sign starts a class selector? (a) . (b) & (c) # (d) @
-
17.🖌️ How big is the text, in px?
h1 {
color: black;
background-color: blue;
text-align: left;
font-size: 16px;
} -
18.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 1024px) {
p {
font-size: 12px;
}
} -
19.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (min-width: 1024px) {
p {
font-size: 20px;
}
} -
20.⚖️ What colour is the text of this element?
<h1 class="note" id="logo">Hi</h1>
CSS:
#logo { color: red; }
#logo { color: black; } (a) red (b) black (c) purple (d) blue -
21.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (min-width: 768px) {
p {
font-size: 22px;
}
} (a) Yes (b) No - 22.⚖️ Which selector is the strongest? (a) an id selector (b) an element selector (c) a class selector
- 23.🌈 In #rrggbb, which colour do the first two digits give? (a) blue (b) green (c) black (d) red
- 24.🎯 Can many elements share the same class? (a) No (b) Yes
-
25.🖌️ What colour are the letters?
li {
text-align: right;
font-size: 36px;
background-color: yellow;
color: white;
} (a) yellow (b) black (c) white -
26.✍️ How many declarations (property: value pairs) are in this rule?
.note {
width: 300px;
color: red;
border: 2px solid;
font-weight: bold;
} -
27.🎯 Which CSS selector matches this element?
<li class="star" id="intro">Hello</li> (a) .menu (b) #star (c) .intro (d) #intro -
28.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 480px) {
p {
font-size: 28px;
}
} - 29.🧩 Which language puts a picture on a page? (a) HTML (b) JavaScript (c) CSS
-
30.✍️ How many declarations (property: value pairs) are in this rule?
h2 {
color: red;
font-size: 20px;
} - 31.🎯 Which element does the selector span style? (a) <h1 class="box"> (b) <span class="box"> (c) <p> (d) <h2 id="end">
- 32.Which of these is the content? (a) space inside the border (b) space outside the border (c) the text or picture (d) a solid or dotted edge
- 33.✍️ CSS declarations go inside which brackets? (a) < > (b) ( ) (c) { } (d) [ ]
- 34.📦 In the box model, which part is a solid or dotted edge? (a) border (b) padding (c) margin (d) content
-
35.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (max-width: 600px) {
p {
font-size: 22px;
}
} - 36.📱 What does a media query check? (a) the battery level (b) the screen width (c) the page title (d) the time of day
-
37.🎯 Which CSS selector matches this element?
<span class="note" id="logo">Hello</span> (a) .big (b) #end (c) #logo (d) p - 38.🌈 Which colour of light is strongest in rgb(243, 33, 75)? (a) red (b) green (c) blue
- 39.Which of these does JavaScript do? (a) makes headings and lists (b) makes a link (c) changes the page live (d) lays out the page
- 40.🌈 Which colour of light is strongest in rgb(59, 8, 191)? (a) red (b) blue (c) green
Answer key
- font-style
- makes a form box
- 150
- .menu
- 2
- on the left
- a class selector
- on the left
- <h2 class="red">
- 300px
- white
- 80
- margin
- 16
- 12
- .
- 16
- 16
- 12
- black
- No
- an id selector
- red
- Yes
- white
- 4
- #intro
- 28
- HTML
- 2
- <span class="box">
- the text or picture
- { }
- border
- 22
- the screen width
- #logo
- red
- changes the page live
- blue
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids