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 element does the selector .star style? (a) <p class="star"> (b) <h1 class="note"> (c) <p class="menu"> (d) <p id="star">
- 2.🖌️ Which CSS property colours behind the text? (a) font-family (b) color (c) background-color (d) font-weight
-
3.📱 The screen is 1366px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 480px) {
p {
font-size: 12px;
}
} (a) Yes (b) No -
4.✍️ Which property is set to yellow in this rule?
#top {
text-align: center;
font-weight: bold;
padding: 8px;
background-color: yellow;
} (a) padding (b) background-color (c) yellow (d) margin -
5.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (min-width: 1024px) {
p {
font-size: 16px;
}
} -
6.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 100px;
padding: 25px;
border: 1px solid black;
margin: 10px;
} -
7.✍️ What is the selector in this CSS rule?
li {
text-align: center;
font-size: 20px;
padding: 8px;
background-color: yellow;
} (a) text-align (b) li (c) body (d) 20px -
8.⚖️ What colour is the text of this element?
<p class="box" id="top">Hi</p>
CSS:
p { color: red; }
.box { color: blue; } (a) red (b) blue (c) black (d) purple - 9.True or false: the content is the gap round content. (a) True (b) False
- 10.🔍 Which is the odd one out? (a) puts a picture on a page (b) makes a link (c) reacts to a button click (d) makes a form box
-
11.📱 The screen is 1366px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (max-width: 600px) {
p {
font-size: 20px;
}
} (a) Yes (b) No - 12.Which of these does CSS do? (a) changes the page live (b) reacts to a button click (c) counts down a timer (d) rounds box corners
-
13.✍️ How many declarations (property: value pairs) are in this rule?
.note {
background-color: yellow;
margin: 10px;
color: red;
font-size: 20px;
} - 14.🎯 Which element does the selector .red style? (a) <h2 id="red"> (b) <h2 class="box"> (c) <li class="star"> (d) <h2 class="red">
-
15.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 290px;
padding: 30px;
border: 2px solid black;
margin: 0px;
} - 16.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 6 (b) 4 (c) 2 (d) 3
- 17.True or false: JavaScript changes the text size. (a) True (b) False
- 18.🎨 Which tag holds CSS inside the head? (a) <css> (b) <body> (c) <style> (d) <script>
- 19.What does justify-content: flex-end do? (a) equal gaps, none at ends (b) puts boxes in the middle (c) packs boxes at the end (d) packs boxes at the start
- 20.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) 800px or wider (c) turned off (d) exactly 100px
- 21.🔍 Which is the odd one out? (a) makes headings and lists (b) puts a picture on a page (c) checks a quiz answer (d) makes a link
-
22.🎯 Which CSS selector matches this element?
<p class="big" id="logo">Hello</p> (a) .red (b) .logo (c) #logo (d) #big - 23.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the first one (b) neither (c) the shorter one (d) the later one
- 24.True or false: JavaScript counts down a timer. (a) False (b) True
-
25.✍️ What is the selector in this CSS rule?
.box {
text-align: center;
color: red;
} (a) text-align (b) red (c) h2 (d) .box - 26.🎯 Which sign starts a class selector? (a) & (b) . (c) @ (d) #
-
27.✍️ What value is given to font-weight in this rule?
h2 {
text-align: center;
font-weight: bold;
} (a) 300px (b) 2px solid (c) bold (d) font-weight -
28.🖌️ What colour are the letters?
h2 {
text-align: left;
font-size: 20px;
background-color: red;
color: white;
} (a) white (b) blue (c) red -
29.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 200px;
justify-content: flex-start;
}
Inside are 2 boxes, each 60px wide (no margins). -
30.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 150px;
justify-content: flex-end;
}
Inside are 3 boxes, each 40px wide (no margins). -
31.📦 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: 25px;
border: 1px solid black;
margin: 10px;
} - 32.Which of these does HTML do? (a) shows a pop-up message (b) makes a form box (c) reacts to a button click (d) sets colours and fonts
- 33.💪 Which justify-content value puts boxes in the middle? (a) flex-start (b) space-between (c) flex-end (d) center
-
34.🖌️ How big is the text, in px?
p {
font-size: 24px;
background-color: black;
color: green;
text-align: left;
} -
35.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (min-width: 600px) {
p {
font-size: 26px;
}
} (a) Yes (b) No - 36.True or false: #logo is an id selector. (a) True (b) False
- 37.🌈 Which colour of light is strongest in rgb(246, 82, 23)? (a) red (b) green (c) blue
-
38.🖌️ What colour are the letters?
li {
background-color: green;
text-align: left;
color: blue;
font-size: 28px;
} (a) green (b) blue (c) yellow - 39.🧩 Which language makes a link? (a) CSS (b) HTML (c) JavaScript
- 40.🧩 Which language puts a picture on a page? (a) JavaScript (b) HTML (c) CSS
Answer key
- <p class="star">
- background-color
- No
- background-color
- 12
- 172
- li
- blue
- False
- reacts to a button click
- No
- rounds box corners
- 4
- <h2 class="red">
- 354
- 3
- False
- <style>
- packs boxes at the end
- 800px or wider
- checks a quiz answer
- #logo
- the later one
- True
- .box
- .
- bold
- white
- 80
- 30
- 112
- makes a form box
- center
- 24
- No
- True
- red
- blue
- HTML
- HTML
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids