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 is the odd one out? (a) changes the page live (b) reacts to a button click (c) sets colours and fonts (d) counts down a timer
-
2.✍️ Which property is set to italic in this rule?
h2 {
border: 2px solid;
font-style: italic;
} (a) font-style (b) font-size (c) color (d) italic - 3.🌈 In #rrggbb, which colour do the last two digits give? (a) green (b) red (c) white (d) blue
- 4.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) the first one (c) neither (d) the later one
- 5.True or false: the content is the line round the box. (a) False (b) True
- 6.🌈 Which colour of light is strongest in rgb(128, 107, 254)? (a) red (b) blue (c) green
- 7.🌈 Which colour of light is strongest in rgb(133, 15, 169)? (a) red (b) green (c) blue
-
8.📱 The screen is 1366px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (min-width: 600px) {
p {
font-size: 22px;
}
} (a) Yes (b) No -
9.✍️ What value is given to width in this rule?
h1 {
background-color: yellow;
width: 300px;
border: 2px solid;
padding: 8px;
} (a) 300px (b) width (c) red (d) italic - 10.🧩 Which language makes headings and lists? (a) CSS (b) JavaScript (c) HTML
- 11.📦 In the box model, which part is a solid or dotted edge? (a) margin (b) border (c) content (d) padding
-
12.🎯 Which CSS selector matches this element?
<h1 class="box" id="intro">Hello</h1> (a) h1 (b) .star (c) .intro (d) #box - 13.Which of these does HTML do? (a) shows a pop-up message (b) changes the text size (c) sets colours and fonts (d) puts a picture on a page
-
14.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 310px;
justify-content: flex-end;
}
Inside are 3 boxes, each 100px wide (no margins). - 15.📦 In the box model, which part is space outside the border? (a) border (b) padding (c) margin (d) content
-
16.⚖️ What colour is the text of this element?
<p class="star" id="top">Hi</p>
CSS:
p { color: white; }
.star { color: blue; }
#top { color: orange; } (a) white (b) red (c) orange (d) blue - 17.True or false: .note is an element selector. (a) True (b) False
-
18.✍️ What is the selector in this CSS rule?
p {
color: red;
padding: 8px;
} (a) p (b) color (c) 8px (d) .note - 19.🎨 A CSS file usually ends with which extension? (a) .html (b) .js (c) .css (d) .png
- 20.✍️ In color: blue; which part is the value? (a) : (b) blue (c) ; (d) color
- 21.True or false: .big is an id selector. (a) True (b) False
- 22.💪 Which justify-content value equal gaps, none at ends? (a) center (b) space-between (c) flex-start (d) flex-end
- 23.⚖️ Which selector is the weakest? (a) a class selector (b) an id selector (c) an element selector
-
24.✍️ Which property is set to center in this rule?
h2 {
margin: 10px;
font-size: 20px;
text-align: center;
width: 300px;
} (a) background-color (b) margin (c) center (d) text-align - 25.✍️ CSS declarations go inside which brackets? (a) [ ] (b) < > (c) ( ) (d) { }
- 26.🎨 Which tag connects an outside CSS file? (a) <img> (b) <css> (c) <a> (d) <link>
- 27.🌈 In #000100 the green part is the hex number 01. What is it as a normal number?
-
28.⚖️ What colour is the text of this element?
<p class="note" id="main">Hi</p>
CSS:
.note { color: red; }
.note { color: green; } (a) white (b) blue (c) red (d) green - 29.💪 Which justify-content value packs boxes at the start? (a) flex-start (b) flex-end (c) space-between (d) center
- 30.🌈 Which colour is rgb(255, 0, 255)? (a) bright green (b) magenta (c) yellow (d) white
-
31.🎯 Which CSS selector matches this element?
<div class="star" id="top">Hello</div> (a) #star (b) span (c) #intro (d) #top - 32.What does justify-content: flex-start do? (a) puts boxes in the middle (b) packs boxes at the end (c) packs boxes at the start (d) equal gaps, none at ends
- 33.🎯 Which element does the selector #top style? (a) <h1 class="top"> (b) <h2 class="box"> (c) <h1 id="top"> (d) <h1 id="intro">
- 34.🎯 What kind of selector is .note? (a) an element selector (b) a class selector (c) an id selector
- 35.🎨 Which tag holds CSS inside the head? (a) <script> (b) <css> (c) <style> (d) <body>
- 36.🎯 What kind of selector is #end? (a) a class selector (b) an id selector (c) an element selector
- 37.What does font-size do? (a) centres a heading (b) makes letters bigger (c) picks the font style (d) makes the text bold
- 38.⚖️ Which selector is the strongest? (a) an element selector (b) an id selector (c) a class selector
-
39.✍️ What is the selector in this CSS rule?
h1 {
color: red;
text-align: center;
} (a) center (b) h1 (c) color (d) p - 40.True or false: the content is space outside the border. (a) False (b) True
Answer key
- sets colours and fonts
- font-style
- blue
- the later one
- False
- blue
- blue
- Yes
- 300px
- HTML
- border
- h1
- puts a picture on a page
- 10
- margin
- orange
- False
- p
- .css
- blue
- False
- space-between
- an element selector
- text-align
- { }
- <link>
- 1
- green
- flex-start
- magenta
- #top
- packs boxes at the start
- <h1 id="top">
- a class selector
- <style>
- an id selector
- makes letters bigger
- an id selector
- h1
- False
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids