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 property is set to bold in this rule?
.box {
font-weight: bold;
font-style: italic;
} (a) border (b) bold (c) width (d) font-weight -
2.🎯 Which CSS selector matches this element?
<h2 class="note" id="top">Hello</h2> (a) h2 (b) #intro (c) .top (d) .big - 3.🔍 Which is the odd one out? (a) gives the page structure (b) makes headings and lists (c) checks a quiz answer (d) puts a picture on a page
- 4.True or false: .star is a class selector. (a) False (b) True
- 5.💪 Which justify-content value packs boxes at the start? (a) flex-end (b) flex-start (c) space-between (d) center
- 6.🧩 Which language reacts to a button click? (a) CSS (b) JavaScript (c) HTML
-
7.⚖️ What colour is the text of this element?
<h1 class="box" id="hero">Hi</h1>
CSS:
#hero { color: black; }
.box { color: purple; } (a) orange (b) black (c) purple (d) yellow -
8.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 1024px) {
p {
font-size: 16px;
}
} - 9.🌈 Which colour of light is strongest in rgb(185, 33, 117)? (a) red (b) green (c) blue
- 10.🎨 Which tag holds CSS inside the head? (a) <css> (b) <script> (c) <body> (d) <style>
-
11.✍️ How many declarations (property: value pairs) are in this rule?
h2 {
padding: 8px;
} -
12.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 200px;
padding: 25px;
border: 3px solid black;
margin: 15px;
} - 13.🖌️ Which CSS property makes letters bigger? (a) font-weight (b) font-size (c) color (d) font-family
- 14.True or false: the border is a solid or dotted edge. (a) False (b) True
- 15.⚖️ Which selector is the weakest? (a) a class selector (b) an element selector (c) an id selector
- 16.🧩 Which language changes the text size? (a) HTML (b) JavaScript (c) CSS
-
17.⚖️ What colour is the text of this element?
<p class="star" id="hero">Hi</p>
CSS:
#hero { color: orange; }
#hero { color: yellow; } (a) orange (b) blue (c) black (d) yellow -
18.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 180px;
padding: 25px;
border: 4px solid black;
margin: 10px;
} -
19.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 260px;
padding: 5px;
border: 1px solid black;
margin: 20px;
} -
20.⚖️ What colour is the text of this element?
<h2 class="red" id="top">Hi</h2>
CSS:
.red { color: black; }
h2 { color: red; } (a) green (b) black (c) white (d) red -
21.🖌️ What colour are the letters?
p {
font-size: 12px;
text-align: right;
color: yellow;
background-color: orange;
} (a) orange (b) yellow (c) blue - 22.True or false: body is a class selector. (a) True (b) False
- 23.🌈 Which colour is rgb(255, 0, 0)? (a) blue (b) white (c) red (d) black
- 24.True or false: #end is a class selector. (a) False (b) True
- 25.✍️ How does a CSS comment start? (a) # (b) // (c) /* (d) <!--
-
26.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 150px;
justify-content: space-between;
}
Inside are 2 boxes, each 40px wide (no margins). - 27.True or false: img is an element selector. (a) False (b) True
- 28.📦 In the box model, which part is a solid or dotted edge? (a) content (b) margin (c) border (d) padding
-
29.🎯 Which CSS selector matches this element?
<p class="menu" id="end">Hello</p> (a) .menu (b) .end (c) #menu (d) h1 - 30.🌈 In #0d0000 the red part is the hex number 0d. What is it as a normal number?
- 31.🔍 Which is the odd one out? (a) lays out the page (b) rounds box corners (c) puts a picture on a page (d) changes the text size
-
32.🖌️ What colour is behind the letters?
p {
text-align: left;
color: purple;
font-size: 24px;
background-color: blue;
} (a) purple (b) yellow (c) blue - 33.🎯 What kind of selector is #main? (a) a class selector (b) an element selector (c) an id selector
-
34.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 140px;
justify-content: space-between;
}
Inside are 2 boxes, each 50px wide (no margins). -
35.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 290px;
padding: 5px;
border: 2px solid black;
margin: 10px;
} - 36.🌈 Which colour is rgb(255, 0, 255)? (a) magenta (b) yellow (c) red (d) bright green
- 37.🔍 Which is the odd one out? (a) makes a form box (b) changes the text size (c) puts a picture on a page (d) makes a link
-
38.✍️ Which property is set to 2px solid in this rule?
h1 {
font-weight: bold;
border: 2px solid;
font-size: 20px;
} (a) font-style (b) width (c) border (d) 2px solid - 39.📱 Which tag helps phones show a page at the right size? (a) the title tag (b) the viewport meta tag (c) the br tag (d) the hr tag
-
40.⚖️ What colour is the text of this element?
<h2 class="menu" id="logo">Hi</h2>
CSS:
#logo { color: black; }
#logo { color: purple; } (a) yellow (b) white (c) black (d) purple
Answer key
- font-weight
- h2
- checks a quiz answer
- True
- flex-start
- JavaScript
- black
- 16
- red
- <style>
- 1
- 286
- font-size
- True
- an element selector
- CSS
- yellow
- 258
- 312
- black
- yellow
- False
- red
- False
- /*
- 70
- True
- border
- .menu
- 13
- puts a picture on a page
- blue
- an id selector
- 40
- 304
- magenta
- changes the text size
- border
- the viewport meta tag
- purple
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids