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 colour are the letters?
li {
text-align: left;
color: yellow;
font-size: 32px;
background-color: orange;
} (a) orange (b) black (c) yellow - 2.🖌️ Which CSS property picks the font style? (a) color (b) font-family (c) background-color (d) font-weight
- 3.⚖️ Which selector is the strongest? (a) a class selector (b) an element selector (c) an id selector
- 4.✍️ CSS declarations go inside which brackets? (a) ( ) (b) { } (c) < > (d) [ ]
- 5.True or false: CSS changes the page live. (a) True (b) False
- 6.Which of these does CSS do? (a) changes the text size (b) counts down a timer (c) reacts to a button click (d) gives the page structure
- 7.True or false: JavaScript makes headings and lists. (a) True (b) False
-
8.✍️ What value is given to border in this rule?
li {
border: 2px solid;
text-align: center;
padding: 8px;
} (a) 300px (b) 2px solid (c) italic (d) border -
9.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 768px) {
p {
font-size: 18px;
}
} -
10.🎯 Which CSS selector matches this element?
<li class="note" id="top">Hello</li> (a) .note (b) div (c) #note (d) #intro - 11.🧩 Which language puts a picture on a page? (a) HTML (b) CSS (c) JavaScript
-
12.✍️ What value is given to background-color in this rule?
h1 {
width: 300px;
background-color: yellow;
} (a) background-color (b) 8px (c) yellow (d) 10px - 13.What does font-family do? (a) makes letters bigger (b) picks the font style (c) colours behind the text (d) sets the letter colour
- 14.🔍 Which is the odd one out? (a) makes a link (b) makes a form box (c) changes the text size (d) puts a picture on a page
- 15.📱 Responsive design means a page ___. (a) has no pictures (b) never changes (c) fits every screen (d) is only for laptops
-
16.📱 The screen is 540px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (max-width: 1024px) {
p {
font-size: 14px;
}
} (a) No (b) Yes -
17.✍️ Which property is set to bold in this rule?
h1 {
font-style: italic;
text-align: center;
font-weight: bold;
} (a) width (b) border (c) font-weight (d) bold - 18.True or false: h1 is a class selector. (a) True (b) False
-
19.✍️ What is the selector in this CSS rule?
p {
padding: 8px;
color: red;
text-align: center;
} (a) .note (b) padding (c) p (d) red - 20.🎨 Which attribute adds CSS inside one tag? (a) style (b) src (c) alt (d) href
-
21.⚖️ What colour is the text of this element?
<p class="note" id="top">Hi</p>
CSS:
p { color: green; }
p { color: purple; } (a) green (b) red (c) blue (d) purple - 22.🌈 Which colour of light is strongest in rgb(131, 212, 85)? (a) green (b) red (c) blue
-
23.📦 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: 3px solid black;
margin: 0px;
} -
24.🖌️ What colour are the letters?
li {
color: blue;
font-size: 32px;
text-align: left;
background-color: white;
} (a) black (b) white (c) blue - 25.✍️ In color: blue; which part is the value? (a) blue (b) color (c) ; (d) :
-
26.⚖️ What colour is the text of this element?
<p class="menu" id="top">Hi</p>
CSS:
.menu { color: purple; }
#top { color: black; } (a) purple (b) red (c) blue (d) black -
27.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 480px) {
p {
font-size: 6px;
}
} -
28.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 280px;
padding: 10px;
border: 1px solid black;
margin: 5px;
} - 29.🖌️ Which CSS property makes letters bigger? (a) color (b) font-weight (c) background-color (d) font-size
-
30.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 90px;
padding: 10px;
border: 4px solid black;
margin: 5px;
} -
31.🎯 Which CSS selector matches this element?
<h2 class="red" id="hero">Hello</h2> (a) #red (b) .hero (c) #top (d) h2 - 32.What does justify-content: space-between do? (a) packs boxes at the end (b) equal gaps, none at ends (c) puts boxes in the middle (d) packs boxes at the start
-
33.🎯 Which CSS selector matches this element?
<span class="box" id="top">Hello</span> (a) #box (b) .star (c) span (d) #intro -
34.✍️ Which property is set to 20px in this rule?
.note {
background-color: yellow;
font-size: 20px;
} (a) background-color (b) font-size (c) 20px (d) text-align - 35.Which of these does CSS do? (a) adds space around boxes (b) checks a quiz answer (c) makes a form box (d) gives the page structure
- 36.🎨 What does CSS stand for? (a) Creative Sheet System (b) Colourful Site Styles (c) Computer Style Sheets (d) Cascading Style Sheets
- 37.📱 Which tag helps phones show a page at the right size? (a) the hr tag (b) the br tag (c) the title tag (d) the viewport meta tag
- 38.💪 Which flexbox property picks row or column? (a) flex-direction (b) justify-content (c) display: flex (d) gap
- 39.🌈 Which colour of light is strongest in rgb(179, 15, 82)? (a) green (b) blue (c) red
-
40.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 768px) {
p {
font-size: 12px;
}
}
Answer key
- yellow
- font-family
- an id selector
- { }
- False
- changes the text size
- False
- 2px solid
- 20
- .note
- HTML
- yellow
- picks the font style
- changes the text size
- fits every screen
- Yes
- font-weight
- False
- p
- style
- purple
- green
- 116
- blue
- blue
- black
- 12
- 312
- font-size
- 128
- h2
- equal gaps, none at ends
- span
- font-size
- adds space around boxes
- Cascading Style Sheets
- the viewport meta tag
- flex-direction
- red
- 12
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids