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.📱 max-width: 600px applies when the screen is ___. (a) 600px or wider (b) 600px or narrower (c) exactly 1000px (d) turned off
-
2.🖌️ What colour is behind the letters?
h1 {
text-align: left;
background-color: orange;
color: yellow;
font-size: 36px;
} (a) yellow (b) blue (c) orange - 3.🎨 A CSS file usually ends with which extension? (a) .html (b) .css (c) .png (d) .js
-
4.✍️ Which property is set to 20px in this rule?
h1 {
text-align: center;
color: red;
margin: 10px;
font-size: 20px;
} (a) background-color (b) 20px (c) text-align (d) font-size -
5.⚖️ What colour is the text of this element?
<h1 class="note" id="top">Hi</h1>
CSS:
#top { color: orange; }
.note { color: yellow; } (a) orange (b) black (c) yellow (d) blue - 6.🔍 Which is the odd one out? (a) counts down a timer (b) makes a form box (c) checks a quiz answer (d) reacts to a button click
-
7.📱 The screen is 414px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 600px) {
p {
font-size: 10px;
}
} (a) No (b) Yes -
8.🖌️ How big is the text, in px?
p {
background-color: white;
font-size: 12px;
color: black;
text-align: left;
} - 9.📦 In the box model, which part is a solid or dotted edge? (a) border (b) content (c) margin (d) padding
- 10.🎨 Which attribute adds CSS inside one tag? (a) href (b) style (c) alt (d) src
- 11.🌈 Which colour is rgb(0, 0, 255)? (a) red (b) yellow (c) cyan (d) blue
- 12.True or false: HTML makes a link. (a) False (b) True
-
13.✍️ What value is given to padding in this rule?
.box {
font-weight: bold;
padding: 8px;
} (a) bold (b) 8px (c) padding (d) 2px solid -
14.🎯 Which CSS selector matches this element?
<p class="big" id="logo">Hello</p> (a) #big (b) p (c) #end (d) .logo -
15.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 160px;
padding: 25px;
border: 1px solid black;
margin: 0px;
} -
16.✍️ What is the selector in this CSS rule?
h1 {
font-style: italic;
font-size: 20px;
width: 300px;
} (a) font-style (b) 20px (c) h1 (d) p - 17.True or false: HTML checks a quiz answer. (a) True (b) False
-
18.📱 The screen is 1366px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (min-width: 600px) {
p {
font-size: 28px;
}
} (a) Yes (b) No -
19.⚖️ What colour is the text of this element?
<h2 class="red" id="top">Hi</h2>
CSS:
.red { color: purple; }
h2 { color: black; }
#top { color: white; } (a) black (b) purple (c) white (d) blue -
20.⚖️ What colour is the text of this element?
<h2 class="star" id="top">Hi</h2>
CSS:
.star { color: yellow; }
.star { color: orange; } (a) orange (b) purple (c) yellow (d) blue - 21.💪 Which justify-content value equal gaps, none at ends? (a) center (b) flex-start (c) space-between (d) flex-end
-
22.✍️ What value is given to padding in this rule?
h2 {
font-size: 20px;
text-align: center;
background-color: yellow;
padding: 8px;
} (a) padding (b) bold (c) 2px solid (d) 8px -
23.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (min-width: 1024px) {
p {
font-size: 28px;
}
} -
24.🖌️ What colour are the letters?
h1 {
background-color: red;
color: yellow;
font-size: 16px;
text-align: right;
} (a) green (b) yellow (c) red - 25.True or false: padding is the gap round content. (a) False (b) True
- 26.📦 In the box model, which part is the gap round content? (a) margin (b) content (c) border (d) padding
- 27.🌈 In #rrggbb, which colour do the last two digits give? (a) white (b) red (c) green (d) blue
- 28.🧩 Which language gives the page structure? (a) JavaScript (b) HTML (c) CSS
- 29.🎯 Which element does the selector #end style? (a) <h1 class="big"> (b) <p id="end"> (c) <p id="hero"> (d) <p class="end">
-
30.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 350px;
justify-content: flex-start;
}
Inside are 4 boxes, each 80px wide (no margins). -
31.⚖️ What colour is the text of this element?
<p class="star" id="intro">Hi</p>
CSS:
.star { color: purple; }
p { color: orange; }
#intro { color: blue; } (a) red (b) blue (c) orange (d) purple - 32.True or false: JavaScript puts a picture on a page. (a) True (b) False
- 33.🌈 Which colour of light is strongest in rgb(222, 63, 75)? (a) blue (b) red (c) green
- 34.Which of these does HTML do? (a) checks a quiz answer (b) makes a link (c) adds space around boxes (d) reacts to a button click
- 35.🎨 Which tag connects an outside CSS file? (a) <img> (b) <css> (c) <a> (d) <link>
- 36.🖌️ Which CSS property sets the letter colour? (a) font-size (b) background-color (c) font-family (d) color
-
37.✍️ How many declarations (property: value pairs) are in this rule?
#top {
background-color: yellow;
border: 2px solid;
margin: 10px;
color: red;
} -
38.⚖️ What colour is the text of this element?
<p class="big" id="logo">Hi</p>
CSS:
.big { color: white; }
#logo { color: orange; } (a) green (b) orange (c) white (d) purple - 39.🎯 Which element does the selector h2 style? (a) <div class="big"> (b) <li> (c) <h2 class="big"> (d) <span id="intro">
- 40.True or false: HTML makes headings and lists. (a) False (b) True
Answer key
- 600px or narrower
- orange
- .css
- font-size
- orange
- makes a form box
- Yes
- 12
- border
- style
- blue
- True
- 8px
- p
- 212
- h1
- False
- Yes
- white
- orange
- space-between
- 8px
- 20
- yellow
- True
- padding
- blue
- HTML
- <p id="end">
- 30
- blue
- False
- red
- makes a link
- <link>
- color
- 4
- orange
- <h2 class="big">
- True
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids