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 does JavaScript do? (a) makes a link (b) makes headings and lists (c) lays out the page (d) checks a quiz answer
- 2.True or false: CSS counts down a timer. (a) False (b) True
- 3.🔍 Which is the odd one out? (a) reacts to a button click (b) makes a form box (c) makes a link (d) makes headings and lists
- 4.📦 In the box model, which part is the gap to other boxes? (a) content (b) border (c) padding (d) margin
-
5.✍️ What value is given to color in this rule?
.note {
text-align: center;
color: red;
} (a) red (b) color (c) 20px (d) center -
6.📱 The screen is 414px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (max-width: 480px) {
p {
font-size: 20px;
}
} (a) Yes (b) No - 7.🌈 Hex digits go 0 to 9, then A to which letter? (a) G (b) J (c) Z (d) F
-
8.📦 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: 20px;
border: 3px solid black;
margin: 10px;
} -
9.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 768px) {
p {
font-size: 22px;
}
} - 10.💪 Which justify-content value equal gaps, none at ends? (a) flex-start (b) center (c) space-between (d) flex-end
-
11.✍️ What value is given to text-align in this rule?
li {
text-align: center;
color: red;
font-size: 20px;
} (a) text-align (b) yellow (c) center (d) 10px -
12.✍️ How many declarations (property: value pairs) are in this rule?
.note {
width: 300px;
text-align: center;
} -
13.✍️ Which property is set to yellow in this rule?
p {
border: 2px solid;
padding: 8px;
font-size: 20px;
background-color: yellow;
} (a) margin (b) background-color (c) padding (d) yellow -
14.🖌️ What colour are the letters?
h2 {
font-size: 16px;
color: green;
text-align: right;
background-color: red;
} (a) green (b) yellow (c) red - 15.✍️ CSS declarations go inside which brackets? (a) < > (b) ( ) (c) { } (d) [ ]
- 16.🎯 Which sign starts a class selector? (a) & (b) @ (c) # (d) .
- 17.Which of these is the border? (a) the gap to other boxes (b) space outside the border (c) space inside the border (d) a solid or dotted edge
- 18.What does justify-content: center do? (a) packs boxes at the start (b) equal gaps, none at ends (c) puts boxes in the middle (d) packs boxes at the end
- 19.🎯 Which element does the selector h1 style? (a) <li class="star"> (b) <h2> (c) <h1 class="star"> (d) <div id="hero">
- 20.🌈 Which colour of light is strongest in rgb(85, 78, 220)? (a) green (b) red (c) blue
-
21.📱 The screen is 1366px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (min-width: 480px) {
p {
font-size: 20px;
}
} (a) Yes (b) No - 22.True or false: padding is the text or picture. (a) False (b) True
- 23.True or false: HTML makes a form box. (a) False (b) True
-
24.✍️ How many declarations (property: value pairs) are in this rule?
li {
color: red;
margin: 10px;
background-color: yellow;
} - 25.💪 Which justify-content value puts boxes in the middle? (a) center (b) space-between (c) flex-end (d) flex-start
- 26.🎨 A CSS file usually ends with which extension? (a) .html (b) .png (c) .js (d) .css
-
27.🖌️ What colour are the letters?
p {
color: black;
background-color: orange;
font-size: 20px;
text-align: left;
} (a) green (b) black (c) orange - 28.⚖️ Which selector is the weakest? (a) an id selector (b) an element selector (c) a class selector
- 29.🌈 Which colour is rgb(0, 0, 0)? (a) black (b) yellow (c) red (d) bright green
-
30.✍️ How many declarations (property: value pairs) are in this rule?
#top {
color: red;
font-size: 20px;
background-color: yellow;
font-weight: bold;
} -
31.✍️ How many declarations (property: value pairs) are in this rule?
.box {
color: red;
width: 300px;
} - 32.🎯 What kind of selector is .card? (a) an element selector (b) a class selector (c) an id selector
- 33.True or false: the border is space outside the border. (a) True (b) False
- 34.🌈 In #440000 the red part is the hex number 44. What is it as a normal number?
- 35.⚖️ Which selector is the strongest? (a) an element selector (b) an id selector (c) a class selector
-
36.🎯 Which CSS selector matches this element?
<h1 class="big" id="intro">Hello</h1> (a) #intro (b) #main (c) .intro (d) .red -
37.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (min-width: 600px) {
p {
font-size: 22px;
}
} - 38.🌈 Which hex code is red? (a) #ff0000 (b) #0000ff (c) #00ffff (d) #ff00ff
- 39.🔍 Which is the odd one out? (a) changes the text size (b) rounds box corners (c) sets colours and fonts (d) changes the page live
-
40.🖌️ Where does the text sit on its line?
h1 {
font-size: 12px;
color: blue;
text-align: right;
background-color: purple;
} (a) on the left (b) on the right (c) in the middle
Answer key
- checks a quiz answer
- False
- reacts to a button click
- margin
- red
- Yes
- F
- 246
- 16
- space-between
- center
- 2
- background-color
- green
- { }
- .
- a solid or dotted edge
- puts boxes in the middle
- <h1 class="star">
- blue
- Yes
- False
- True
- 3
- center
- .css
- black
- an element selector
- black
- 4
- 2
- a class selector
- False
- 68
- an id selector
- #intro
- 20
- #ff0000
- changes the page live
- on the right
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids