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 does a media query check? (a) the screen width (b) the page title (c) the battery level (d) the time of day
- 2.What does justify-content: space-between do? (a) packs boxes at the start (b) packs boxes at the end (c) puts boxes in the middle (d) equal gaps, none at ends
-
3.📱 The screen is 540px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (max-width: 768px) {
p {
font-size: 22px;
}
} (a) No (b) Yes - 4.🌈 Which colour is rgb(0, 0, 0)? (a) red (b) black (c) cyan (d) yellow
- 5.🌈 Which colour is rgb(0, 255, 0)? (a) magenta (b) yellow (c) bright green (d) black
-
6.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 160px;
justify-content: center;
}
Inside are 2 boxes, each 40px wide (no margins). - 7.True or false: JavaScript rounds box corners. (a) True (b) False
- 8.🧩 Which language reacts to a button click? (a) CSS (b) HTML (c) JavaScript
- 9.🌈 Which colour of light is strongest in rgb(50, 166, 33)? (a) green (b) red (c) blue
- 10.📦 In the box model, which part is a solid or dotted edge? (a) border (b) padding (c) content (d) margin
-
11.📱 The screen is 1100px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 480px) {
p {
font-size: 26px;
}
} (a) No (b) Yes - 12.What does background-color do? (a) picks the font style (b) sets the letter colour (c) colours behind the text (d) centres a heading
-
13.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 100px;
justify-content: flex-start;
}
Inside are 2 boxes, each 40px wide (no margins). - 14.True or false: CSS counts down a timer. (a) True (b) False
- 15.🌈 Which colour is #ffff00? (a) blue (b) yellow (c) red (d) white
- 16.🎯 Which element does the selector p style? (a) <h2 class="big"> (b) <h1> (c) <li id="logo"> (d) <p class="big">
- 17.🎯 Which element does the selector .star style? (a) <span class="note"> (b) <div class="star"> (c) <div class="menu"> (d) <div id="star">
-
18.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (min-width: 1024px) {
p {
font-size: 20px;
}
} (a) Yes (b) No - 19.🎯 Which element does the selector li style? (a) <li class="box"> (b) <div> (c) <p id="logo"> (d) <span class="box">
- 20.True or false: .card is an element selector. (a) True (b) False
- 21.📱 min-width: 800px applies when the screen is ___. (a) 800px or wider (b) turned off (c) exactly 100px (d) 800px or narrower
- 22.✍️ Which sign goes between a property and its value? (a) = (b) ; (c) - (d) :
-
23.✍️ Which property is set to italic in this rule?
body {
border: 2px solid;
font-style: italic;
font-weight: bold;
} (a) italic (b) font-style (c) color (d) font-size -
24.🖌️ How big is the text, in px?
h2 {
background-color: purple;
text-align: center;
color: black;
font-size: 24px;
} - 25.True or false: .note is a class selector. (a) True (b) False
- 26.✍️ In color: blue; which part is the property? (a) color (b) blue (c) : (d) ;
- 27.🎯 Which element does the selector .star style? (a) <div class="note"> (b) <li class="star"> (c) <li id="star"> (d) <li class="menu">
-
28.✍️ How many declarations (property: value pairs) are in this rule?
#top {
font-size: 20px;
} -
29.✍️ What value is given to font-size in this rule?
p {
background-color: yellow;
width: 300px;
color: red;
font-size: 20px;
} (a) yellow (b) 20px (c) center (d) font-size - 30.🎨 Which tag connects an outside CSS file? (a) <a> (b) <css> (c) <img> (d) <link>
- 31.What does justify-content: flex-end 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
- 32.🌈 Which hex code is white? (a) #0000ff (b) #ffffff (c) #ff0000 (d) #000000
-
33.🖌️ What colour is behind the letters?
li {
background-color: white;
font-size: 16px;
text-align: left;
color: green;
} (a) white (b) red (c) green -
34.✍️ What value is given to background-color in this rule?
p {
font-weight: bold;
width: 300px;
background-color: yellow;
font-size: 20px;
} (a) yellow (b) 10px (c) background-color (d) 8px - 35.✍️ How does a CSS comment start? (a) /* (b) // (c) # (d) <!--
-
36.🖌️ How big is the text, in px?
li {
font-size: 32px;
color: yellow;
text-align: right;
background-color: orange;
} - 37.🌈 In #6a0000 the red part is the hex number 6a. What is it as a normal number?
- 38.Which of these does HTML do? (a) changes the page live (b) checks a quiz answer (c) makes headings and lists (d) shows a pop-up message
- 39.🎯 Which element does the selector span style? (a) <h1 class="star"> (b) <span class="star"> (c) <p> (d) <h2 id="hero">
- 40.True or false: .big is a class selector. (a) True (b) False
Answer key
- the screen width
- equal gaps, none at ends
- Yes
- black
- bright green
- 40
- False
- JavaScript
- green
- border
- Yes
- colours behind the text
- 20
- False
- yellow
- <p class="big">
- <div class="star">
- No
- <li class="box">
- False
- 800px or wider
- :
- font-style
- 24
- True
- color
- <li class="star">
- 1
- 20px
- <link>
- packs boxes at the end
- #ffffff
- white
- yellow
- /*
- 32
- 106
- makes headings and lists
- <span class="star">
- True
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids