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 language lays out the page? (a) JavaScript (b) CSS (c) HTML
- 2.True or false: margin is space outside the border. (a) True (b) False
-
3.✍️ How many declarations (property: value pairs) are in this rule?
#top {
padding: 8px;
} - 4.What does text-align do? (a) makes the text bold (b) centres a heading (c) makes letters bigger (d) colours behind the text
- 5.💪 Which justify-content value packs boxes at the end? (a) flex-start (b) center (c) space-between (d) flex-end
-
6.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (min-width: 600px) {
p {
font-size: 18px;
}
} - 7.🌈 Which colour is rgb(0, 0, 0)? (a) magenta (b) black (c) yellow (d) red
-
8.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 768px) {
p {
font-size: 24px;
}
} - 9.✍️ Which sign ends each CSS declaration? (a) , (b) . (c) ; (d) :
- 10.What does justify-content: flex-start 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
-
11.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 600px) {
p {
font-size: 10px;
}
} (a) No (b) Yes - 12.True or false: padding is a solid or dotted edge. (a) False (b) True
-
13.🎯 Which CSS selector matches this element?
<li class="menu" id="intro">Hello</li> (a) div (b) #menu (c) #intro (d) .note - 14.True or false: JavaScript puts a picture on a page. (a) False (b) True
- 15.🧩 Which language adds space around boxes? (a) HTML (b) JavaScript (c) CSS
-
16.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 1024px) {
p {
font-size: 10px;
}
} -
17.⚖️ What colour is the text of this element?
<h2 class="menu" id="end">Hi</h2>
CSS:
#end { color: blue; }
h2 { color: yellow; } (a) black (b) orange (c) yellow (d) blue - 18.🎨 Which tag holds CSS inside the head? (a) <script> (b) <body> (c) <style> (d) <css>
-
19.🎯 Which CSS selector matches this element?
<span class="big" id="end">Hello</span> (a) p (b) .end (c) .big (d) #big - 20.⚖️ Which selector is the weakest? (a) a class selector (b) an id selector (c) an element selector
-
21.✍️ Which property is set to yellow in this rule?
.note {
background-color: yellow;
text-align: center;
font-weight: bold;
} (a) background-color (b) margin (c) padding (d) yellow - 22.Which of these is padding? (a) the gap round content (b) space outside the border (c) the line round the box (d) a solid or dotted edge
-
23.📱 The screen is 540px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 480px) {
p {
font-size: 12px;
}
} (a) No (b) Yes - 24.🖌️ Which CSS property colours behind the text? (a) font-family (b) text-align (c) background-color (d) font-size
- 25.🔍 Which is the odd one out? (a) gives the page structure (b) makes headings and lists (c) adds space around boxes (d) makes a link
- 26.🎨 A CSS file usually ends with which extension? (a) .png (b) .js (c) .css (d) .html
- 27.🖌️ Which CSS property makes letters bigger? (a) font-size (b) text-align (c) background-color (d) color
- 28.True or false: .note is a class selector. (a) False (b) True
- 29.🖌️ Which CSS property sets the letter colour? (a) color (b) font-size (c) font-family (d) background-color
- 30.✍️ Which sign goes between a property and its value? (a) = (b) : (c) ; (d) -
-
31.⚖️ What colour is the text of this element?
<h2 class="menu" id="logo">Hi</h2>
CSS:
#logo { color: black; }
#logo { color: orange; } (a) red (b) orange (c) yellow (d) black - 32.💪 Which justify-content value packs boxes at the start? (a) flex-start (b) space-between (c) flex-end (d) center
-
33.✍️ How many declarations (property: value pairs) are in this rule?
#top {
font-weight: bold;
background-color: yellow;
font-style: italic;
font-size: 20px;
} -
34.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (min-width: 480px) {
p {
font-size: 22px;
}
} - 35.🌈 In #rrggbb, which colour do the last two digits give? (a) red (b) white (c) green (d) blue
-
36.🖌️ How big is the text, in px?
p {
background-color: red;
font-size: 16px;
text-align: center;
color: yellow;
} - 37.🔍 Which is the odd one out? (a) makes a form box (b) rounds box corners (c) gives the page structure (d) puts a picture on a page
- 38.🎨 What does CSS stand for? (a) Cascading Style Sheets (b) Computer Style Sheets (c) Colourful Site Styles (d) Creative Sheet System
-
39.🎯 Which CSS selector matches this element?
<li class="menu" id="main">Hello</li> (a) div (b) #logo (c) #menu (d) #main -
40.🎯 Which CSS selector matches this element?
<h2 class="note" id="intro">Hello</h2> (a) .big (b) #intro (c) li (d) .intro
Answer key
- CSS
- True
- 1
- centres a heading
- flex-end
- 12
- black
- 16
- ;
- packs boxes at the start
- Yes
- False
- #intro
- False
- CSS
- 10
- blue
- <style>
- .big
- an element selector
- background-color
- the gap round content
- No
- background-color
- adds space around boxes
- .css
- font-size
- True
- color
- :
- orange
- flex-start
- 4
- 22
- blue
- 16
- rounds box corners
- Cascading Style Sheets
- #main
- #intro
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids