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.🎯 How many elements on a page should have the same id? (a) 2 (b) any number (c) 5 (d) 1
- 2.🖌️ Which CSS property makes letters bigger? (a) font-size (b) background-color (c) color (d) text-align
- 3.🎯 What kind of selector is body? (a) a class selector (b) an element selector (c) an id selector
-
4.📱 The screen is 540px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 1024px) {
p {
font-size: 8px;
}
} (a) No (b) Yes -
5.⚖️ What colour is the text of this element?
<h2 class="note" id="top">Hi</h2>
CSS:
h2 { color: blue; }
.note { color: yellow; }
#top { color: black; } (a) purple (b) black (c) blue (d) yellow - 6.🎯 What kind of selector is p? (a) a class selector (b) an id selector (c) an element selector
- 7.True or false: HTML puts a picture on a page. (a) False (b) True
- 8.What does text-align do? (a) sets the letter colour (b) makes the text bold (c) centres a heading (d) picks the font style
-
9.⚖️ What colour is the text of this element?
<h1 class="big" id="logo">Hi</h1>
CSS:
h1 { color: white; }
h1 { color: black; } (a) white (b) blue (c) green (d) black - 10.🧩 Which language puts a picture on a page? (a) JavaScript (b) CSS (c) HTML
- 11.🌈 Which colour is #00ff00? (a) black (b) white (c) bright green (d) red
-
12.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 768px) {
p {
font-size: 12px;
}
} - 13.✍️ Which sign ends each CSS declaration? (a) . (b) , (c) : (d) ;
-
14.⚖️ What colour is the text of this element?
<h1 class="red" id="end">Hi</h1>
CSS:
h1 { color: green; }
h1 { color: black; } (a) blue (b) green (c) red (d) black - 15.🎨 Which tag holds CSS inside the head? (a) <script> (b) <body> (c) <style> (d) <css>
- 16.🌈 What is the biggest number one colour can have in rgb()? (a) 255 (b) 1000 (c) 99 (d) 100
-
17.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 768px) {
p {
font-size: 14px;
}
} -
18.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 110px;
justify-content: flex-end;
}
Inside are 2 boxes, each 40px wide (no margins). -
19.✍️ How many declarations (property: value pairs) are in this rule?
p {
font-size: 20px;
font-style: italic;
font-weight: bold;
border: 2px solid;
} - 20.🔍 Which is the odd one out? (a) makes headings and lists (b) changes the page live (c) puts a picture on a page (d) gives the page structure
-
21.📱 The screen is 540px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 1024px) {
p {
font-size: 32px;
}
} (a) No (b) Yes - 22.💪 Which justify-content value packs boxes at the start? (a) flex-end (b) flex-start (c) center (d) space-between
- 23.What does color do? (a) sets the letter colour (b) colours behind the text (c) picks the font style (d) makes the text bold
- 24.🖌️ Which CSS property sets the letter colour? (a) text-align (b) font-weight (c) color (d) font-size
-
25.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 1024px) {
p {
font-size: 8px;
}
} - 26.What does justify-content: flex-start do? (a) equal gaps, none at ends (b) packs boxes at the start (c) packs boxes at the end (d) puts boxes in the middle
- 27.📦 In the box model, which part is the text or picture? (a) content (b) margin (c) padding (d) border
-
28.⚖️ What colour is the text of this element?
<h1 class="big" id="intro">Hi</h1>
CSS:
h1 { color: blue; }
h1 { color: black; } (a) black (b) blue (c) purple (d) green - 29.Which of these is the border? (a) space inside the border (b) the text or picture (c) space outside the border (d) a solid or dotted edge
- 30.📱 Responsive design means a page ___. (a) never changes (b) has no pictures (c) fits every screen (d) is only for laptops
- 31.💪 Which justify-content value equal gaps, none at ends? (a) flex-end (b) space-between (c) flex-start (d) center
- 32.🔍 Which is the odd one out? (a) counts down a timer (b) shows a pop-up message (c) rounds box corners (d) checks a quiz answer
- 33.True or false: padding is the line round the box. (a) False (b) True
- 34.🎨 What does CSS stand for? (a) Creative Sheet System (b) Cascading Style Sheets (c) Computer Style Sheets (d) Colourful Site Styles
- 35.🧩 Which language gives the page structure? (a) HTML (b) CSS (c) JavaScript
- 36.🎯 What kind of selector is #top? (a) an id selector (b) an element selector (c) a class selector
-
37.📱 The screen is 700px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 600px) {
p {
font-size: 28px;
}
} (a) Yes (b) No - 38.🌈 Which hex code is magenta? (a) #000000 (b) #0000ff (c) #ff00ff (d) #ff0000
-
39.🖌️ Where does the text sit on its line?
h1 {
font-size: 32px;
background-color: blue;
text-align: left;
color: red;
} (a) in the middle (b) on the right (c) on the left -
40.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 768px) {
p {
font-size: 22px;
}
}
Answer key
- 1
- font-size
- an element selector
- Yes
- black
- an element selector
- True
- centres a heading
- black
- HTML
- bright green
- 16
- ;
- black
- <style>
- 255
- 14
- 30
- 4
- changes the page live
- No
- flex-start
- sets the letter colour
- color
- 8
- packs boxes at the start
- content
- black
- a solid or dotted edge
- fits every screen
- space-between
- rounds box corners
- False
- Cascading Style Sheets
- HTML
- an id selector
- Yes
- #ff00ff
- on the left
- 22
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids