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.True or false: HTML adds space around boxes. (a) False (b) True
- 2.🌈 Which colour is #0000ff? (a) bright green (b) blue (c) black (d) red
-
3.🎯 Which CSS selector matches this element?
<h1 class="red" id="intro">Hello</h1> (a) h1 (b) #main (c) #red (d) h2 -
4.⚖️ What colour is the text of this element?
<h2 class="box" id="top">Hi</h2>
CSS:
h2 { color: black; }
#top { color: orange; }
.box { color: red; } (a) red (b) orange (c) black (d) purple -
5.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 600px) {
p {
font-size: 8px;
}
} (a) No (b) Yes -
6.🖌️ Where does the text sit on its line?
h1 {
text-align: left;
color: blue;
background-color: purple;
font-size: 24px;
} (a) in the middle (b) on the right (c) on the left - 7.True or false: HTML makes a form box. (a) False (b) True
-
8.⚖️ What colour is the text of this element?
<p class="red" id="intro">Hi</p>
CSS:
p { color: red; }
.red { color: green; } (a) green (b) red (c) yellow (d) white - 9.📱 Responsive design means a page ___. (a) never changes (b) is only for laptops (c) fits every screen (d) has no pictures
-
10.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 50px;
padding: 20px;
border: 5px solid black;
margin: 5px;
} - 11.✍️ In color: blue; which part is the property? (a) blue (b) color (c) ; (d) :
-
12.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 1024px) {
p {
font-size: 12px;
}
} -
13.⚖️ What colour is the text of this element?
<p class="note" id="end">Hi</p>
CSS:
#end { color: yellow; }
p { color: blue; }
.note { color: red; } (a) red (b) white (c) yellow (d) blue - 14.🎨 What does CSS stand for? (a) Colourful Site Styles (b) Creative Sheet System (c) Cascading Style Sheets (d) Computer Style Sheets
- 15.✍️ How does a CSS comment start? (a) /* (b) <!-- (c) # (d) //
- 16.True or false: padding is a solid or dotted edge. (a) False (b) True
- 17.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) the first one (c) the later one (d) neither
- 18.🎯 Can many elements share the same class? (a) No (b) Yes
- 19.🔍 Which is the odd one out? (a) shows a pop-up message (b) reacts to a button click (c) counts down a timer (d) sets colours and fonts
-
20.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 300px;
padding: 10px;
border: 4px solid black;
margin: 20px;
} - 21.🌈 Which colour of light is strongest in rgb(178, 24, 63)? (a) red (b) green (c) blue
-
22.📱 The screen is 820px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 600px) {
p {
font-size: 26px;
}
} (a) Yes (b) No - 23.🎯 Which sign starts a class selector? (a) & (b) . (c) @ (d) #
- 24.True or false: body is a class selector. (a) False (b) True
- 25.🔍 Which is the odd one out? (a) gives the page structure (b) puts a picture on a page (c) changes the page live (d) makes a link
- 26.What does background-color do? (a) centres a heading (b) colours behind the text (c) picks the font style (d) sets the letter colour
-
27.⚖️ What colour is the text of this element?
<h2 class="note" id="end">Hi</h2>
CSS:
h2 { color: green; }
.note { color: blue; }
#end { color: purple; } (a) blue (b) purple (c) green (d) black - 28.📦 In the box model, which part is space outside the border? (a) border (b) content (c) padding (d) margin
-
29.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 300px;
justify-content: space-between;
}
Inside are 3 boxes, each 80px wide (no margins). - 30.🧩 Which language gives the page structure? (a) CSS (b) JavaScript (c) HTML
-
31.✍️ How many declarations (property: value pairs) are in this rule?
p {
border: 2px solid;
text-align: center;
color: red;
} - 32.✍️ Which sign goes between a property and its value? (a) ; (b) : (c) - (d) =
-
33.⚖️ What colour is the text of this element?
<h1 class="red" id="logo">Hi</h1>
CSS:
#logo { color: purple; }
.red { color: green; } (a) black (b) green (c) white (d) purple - 34.🎯 Which element does the selector .box style? (a) <span class="menu"> (b) <div class="star"> (c) <div id="box"> (d) <div class="box">
- 35.🎨 Which tag connects an outside CSS file? (a) <css> (b) <img> (c) <link> (d) <a>
- 36.True or false: the content is the line round the box. (a) True (b) False
-
37.⚖️ What colour is the text of this element?
<h2 class="menu" id="end">Hi</h2>
CSS:
#end { color: green; }
#end { color: orange; } (a) orange (b) yellow (c) black (d) green - 38.✍️ CSS declarations go inside which brackets? (a) { } (b) [ ] (c) ( ) (d) < >
- 39.True or false: .star is a class selector. (a) True (b) False
-
40.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 420px;
justify-content: center;
}
Inside are 4 boxes, each 80px wide (no margins).
Answer key
- False
- blue
- h1
- orange
- Yes
- on the left
- True
- green
- fits every screen
- 110
- color
- 12
- yellow
- Cascading Style Sheets
- /*
- False
- the later one
- Yes
- sets colours and fonts
- 328
- red
- Yes
- .
- False
- changes the page live
- colours behind the text
- purple
- margin
- 30
- HTML
- 3
- :
- purple
- <div class="box">
- <link>
- False
- orange
- { }
- True
- 50
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids