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 20px in this rule?
p {
color: red;
font-size: 20px;
background-color: yellow;
} (a) font-size (b) background-color (c) 20px (d) text-align - 2.True or false: #main is an id selector. (a) True (b) False
- 3.🎯 What kind of selector is li? (a) an id selector (b) a class selector (c) an element selector
-
4.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 1024px) {
p {
font-size: 26px;
}
} - 5.🌈 Which hex code is magenta? (a) #ffffff (b) #ff00ff (c) #000000 (d) #ff0000
- 6.🖌️ Which CSS property colours behind the text? (a) background-color (b) font-family (c) font-size (d) text-align
- 7.True or false: HTML shows a pop-up message. (a) True (b) False
-
8.📱 The screen is 820px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 768px) {
p {
font-size: 30px;
}
} (a) Yes (b) No - 9.🎯 Which sign starts a class selector? (a) . (b) # (c) @ (d) &
- 10.🌈 Which colour is rgb(255, 0, 0)? (a) black (b) bright green (c) cyan (d) red
- 11.🧩 Which language makes headings and lists? (a) JavaScript (b) CSS (c) HTML
- 12.📦 In the box model, which part is space inside the border? (a) margin (b) border (c) padding (d) content
-
13.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 500px;
justify-content: center;
}
Inside are 4 boxes, each 100px wide (no margins). -
14.🖌️ What colour is behind the letters?
p {
color: red;
text-align: center;
background-color: white;
font-size: 24px;
} (a) purple (b) red (c) white - 15.🖌️ Which CSS property makes letters bigger? (a) font-family (b) color (c) background-color (d) font-size
- 16.🧩 Which language reacts to a button click? (a) HTML (b) CSS (c) JavaScript
- 17.⚖️ Which selector is the strongest? (a) an id selector (b) a class selector (c) an element selector
- 18.🌈 Which colour of light is strongest in rgb(237, 5, 112)? (a) green (b) blue (c) red
- 19.True or false: .star is an id selector. (a) True (b) False
- 20.🌈 Which colour is rgb(255, 0, 255)? (a) black (b) yellow (c) bright green (d) magenta
- 21.True or false: CSS makes a link. (a) True (b) False
- 22.🌈 What is the biggest number one colour can have in rgb()? (a) 99 (b) 1000 (c) 100 (d) 255
- 23.🎯 Which element does the selector span style? (a) <p> (b) <h1 class="box"> (c) <span class="box"> (d) <h2 id="intro">
- 24.✍️ How does a CSS comment start? (a) <!-- (b) /* (c) // (d) #
- 25.True or false: CSS lays out the page. (a) False (b) True
-
26.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 390px;
justify-content: space-between;
}
Inside are 4 boxes, each 60px wide (no margins). -
27.✍️ How many declarations (property: value pairs) are in this rule?
h1 {
background-color: yellow;
} - 28.True or false: padding is the text or picture. (a) True (b) False
-
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: 60px;
padding: 30px;
border: 3px solid black;
margin: 5px;
} - 30.✍️ CSS declarations go inside which brackets? (a) [ ] (b) < > (c) ( ) (d) { }
-
31.✍️ How many declarations (property: value pairs) are in this rule?
li {
width: 300px;
color: red;
font-weight: bold;
border: 2px solid;
} - 32.🧩 Which language checks a quiz answer? (a) CSS (b) HTML (c) JavaScript
-
33.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 1024px) {
p {
font-size: 30px;
}
} -
34.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (min-width: 480px) {
p {
font-size: 20px;
}
} - 35.✍️ In color: blue; which part is the property? (a) blue (b) : (c) color (d) ;
-
36.⚖️ What colour is the text of this element?
<p class="menu" id="top">Hi</p>
CSS:
p { color: yellow; }
.menu { color: black; } (a) yellow (b) red (c) black (d) orange - 37.True or false: CSS adds space around boxes. (a) False (b) True
- 38.🌈 In #0000a3 the blue part is the hex number a3. What is it as a normal number?
-
39.✍️ What is the selector in this CSS rule?
.note {
padding: 8px;
width: 300px;
text-align: center;
} (a) 300px (b) padding (c) #top (d) .note -
40.🎯 Which CSS selector matches this element?
<h1 class="menu" id="top">Hello</h1> (a) .top (b) h1 (c) .note (d) #intro
Answer key
- font-size
- True
- an element selector
- 26
- #ff00ff
- background-color
- False
- Yes
- .
- red
- HTML
- padding
- 50
- white
- font-size
- JavaScript
- an id selector
- red
- False
- magenta
- False
- 255
- <span class="box">
- /*
- True
- 50
- 1
- False
- 126
- { }
- 4
- JavaScript
- 24
- 20
- color
- black
- True
- 163
- .note
- h1
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids