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 of these does HTML do? (a) shows a pop-up message (b) lays out the page (c) makes a link (d) rounds box corners
-
2.✍️ What value is given to font-style in this rule?
#top {
font-style: italic;
font-size: 20px;
border: 2px solid;
width: 300px;
} (a) 20px (b) red (c) italic (d) font-style - 3.True or false: #main is an id selector. (a) True (b) False
- 4.🧩 Which language sets colours and fonts? (a) HTML (b) JavaScript (c) CSS
- 5.⚖️ Which selector is the strongest? (a) an element selector (b) a class selector (c) an id selector
- 6.🔍 Which is the odd one out? (a) makes a form box (b) puts a picture on a page (c) makes headings and lists (d) adds space around boxes
-
7.✍️ What value is given to color in this rule?
h2 {
color: red;
border: 2px solid;
background-color: yellow;
font-size: 20px;
} (a) center (b) 20px (c) color (d) red - 8.🖌️ Which CSS property colours behind the text? (a) font-family (b) background-color (c) color (d) font-size
-
9.✍️ How many declarations (property: value pairs) are in this rule?
.note {
color: red;
font-style: italic;
} -
10.⚖️ What colour is the text of this element?
<h2 class="star" id="hero">Hi</h2>
CSS:
h2 { color: purple; }
.star { color: blue; } (a) blue (b) purple (c) white (d) orange - 11.🖌️ Which CSS property makes the text bold? (a) font-size (b) font-weight (c) background-color (d) color
- 12.✍️ How does a CSS comment start? (a) /* (b) // (c) # (d) <!--
-
13.🖌️ How big is the text, in px?
h1 {
color: green;
text-align: center;
font-size: 16px;
background-color: black;
} -
14.✍️ What is the selector in this CSS rule?
.note {
color: red;
margin: 10px;
} (a) 10px (b) #top (c) .note (d) color - 15.🎨 A CSS file usually ends with which extension? (a) .html (b) .css (c) .png (d) .js
-
16.⚖️ What colour is the text of this element?
<p class="big" id="top">Hi</p>
CSS:
#top { color: yellow; }
#top { color: blue; } (a) yellow (b) blue (c) black (d) green - 17.💪 Which justify-content value puts boxes in the middle? (a) flex-start (b) flex-end (c) space-between (d) center
- 18.🌈 Hex digits go 0 to 9, then A to which letter? (a) J (b) Z (c) G (d) F
-
19.✍️ How many declarations (property: value pairs) are in this rule?
.note {
background-color: yellow;
} - 20.🖌️ Which CSS property picks the font style? (a) font-family (b) font-size (c) color (d) background-color
- 21.📱 max-width: 600px applies when the screen is ___. (a) turned off (b) 600px or narrower (c) 600px or wider (d) exactly 1000px
- 22.💪 Which flexbox property turns on flexbox? (a) align-items (b) display: flex (c) flex-direction (d) justify-content
- 23.True or false: #top is a class selector. (a) True (b) False
- 24.🎯 Which element does the selector #end style? (a) <h2 class="box"> (b) <h1 class="end"> (c) <h1 id="hero"> (d) <h1 id="end">
- 25.📦 In the box model, which part is the gap round content? (a) content (b) padding (c) margin (d) border
-
26.🖌️ Where does the text sit on its line?
h1 {
font-size: 28px;
background-color: blue;
text-align: right;
color: red;
} (a) on the right (b) on the left (c) in the middle - 27.🔍 Which is the odd one out? (a) lays out the page (b) checks a quiz answer (c) changes the text size (d) rounds box corners
- 28.True or false: the content is the text or picture. (a) False (b) True
- 29.🧩 Which language lays out the page? (a) JavaScript (b) HTML (c) CSS
- 30.True or false: CSS checks a quiz answer. (a) True (b) False
-
31.⚖️ What colour is the text of this element?
<p class="note" id="end">Hi</p>
CSS:
p { color: purple; }
#end { color: yellow; }
.note { color: red; } (a) red (b) yellow (c) white (d) purple - 32.Which of these does JavaScript do? (a) checks a quiz answer (b) changes the text size (c) makes a link (d) sets colours and fonts
-
33.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 768px) {
p {
font-size: 6px;
}
} (a) No (b) Yes -
34.⚖️ What colour is the text of this element?
<h2 class="big" id="intro">Hi</h2>
CSS:
.big { color: orange; }
#intro { color: green; } (a) blue (b) black (c) green (d) orange - 35.🎯 What kind of selector is img? (a) a class selector (b) an element selector (c) an id selector
-
36.✍️ What value is given to text-align in this rule?
h2 {
text-align: center;
padding: 8px;
margin: 10px;
background-color: yellow;
} (a) center (b) text-align (c) 10px (d) yellow -
37.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 600px) {
p {
font-size: 14px;
}
} -
38.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 1024px) {
p {
font-size: 18px;
}
} -
39.✍️ What value is given to color in this rule?
p {
color: red;
font-style: italic;
text-align: center;
} (a) color (b) center (c) 20px (d) red - 40.Which of these does HTML do? (a) adds space around boxes (b) makes a form box (c) sets colours and fonts (d) changes the page live
Answer key
- makes a link
- italic
- True
- CSS
- an id selector
- adds space around boxes
- red
- background-color
- 2
- blue
- font-weight
- /*
- 16
- .note
- .css
- blue
- center
- F
- 1
- font-family
- 600px or narrower
- display: flex
- False
- <h1 id="end">
- padding
- on the right
- checks a quiz answer
- True
- CSS
- False
- yellow
- checks a quiz answer
- Yes
- green
- an element selector
- center
- 20
- 18
- red
- makes a form box
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids