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 italic in this rule?
li {
text-align: center;
font-style: italic;
} (a) font-style (b) color (c) font-size (d) italic - 2.🌈 Which colour is rgb(0, 255, 0)? (a) cyan (b) white (c) red (d) bright green
- 3.Which of these does JavaScript do? (a) shows a pop-up message (b) makes headings and lists (c) makes a link (d) changes the text size
- 4.✍️ Which sign goes between a property and its value? (a) ; (b) - (c) : (d) =
-
5.🎯 Which CSS selector matches this element?
<p class="red" id="top">Hello</p> (a) #intro (b) #red (c) p (d) .top -
6.📱 The screen is 820px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (min-width: 768px) {
p {
font-size: 16px;
}
} (a) No (b) Yes - 7.🎯 Can many elements share the same class? (a) Yes (b) No
- 8.🎯 What kind of selector is .star? (a) an element selector (b) a class selector (c) an id selector
- 9.What does color do? (a) makes the text bold (b) makes letters bigger (c) sets the letter colour (d) picks the font style
-
10.⚖️ What colour is the text of this element?
<h1 class="menu" id="main">Hi</h1>
CSS:
h1 { color: purple; }
h1 { color: green; } (a) purple (b) green (c) blue (d) white - 11.True or false: the border is a solid or dotted edge. (a) False (b) True
-
12.⚖️ What colour is the text of this element?
<h1 class="red" id="top">Hi</h1>
CSS:
.red { color: white; }
#top { color: blue; }
h1 { color: black; } (a) black (b) red (c) blue (d) white -
13.⚖️ What colour is the text of this element?
<h2 class="big" id="intro">Hi</h2>
CSS:
.big { color: yellow; }
h2 { color: blue; } (a) white (b) blue (c) yellow (d) purple - 14.🎯 Which element does the selector #intro style? (a) <div id="main"> (b) <span class="box"> (c) <div class="intro"> (d) <div id="intro">
- 15.True or false: padding is the gap to other boxes. (a) False (b) True
- 16.Which of these does HTML do? (a) gives the page structure (b) counts down a timer (c) reacts to a button click (d) lays out the page
- 17.🎨 Which tag connects an outside CSS file? (a) <css> (b) <link> (c) <img> (d) <a>
-
18.✍️ How many declarations (property: value pairs) are in this rule?
p {
font-size: 20px;
margin: 10px;
} -
19.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 1024px) {
p {
font-size: 12px;
}
} -
20.⚖️ What colour is the text of this element?
<p class="red" id="top">Hi</p>
CSS:
p { color: yellow; }
p { color: orange; } (a) blue (b) white (c) orange (d) yellow -
21.✍️ What value is given to font-size in this rule?
h1 {
text-align: center;
font-size: 20px;
} (a) 20px (b) yellow (c) center (d) font-size - 22.🎯 Which element does the selector .box style? (a) <div class="box"> (b) <div id="box"> (c) <span class="menu"> (d) <div class="star">
- 23.🔍 Which is the odd one out? (a) puts a picture on a page (b) makes a form box (c) makes headings and lists (d) lays out the page
-
24.⚖️ What colour is the text of this element?
<p class="big" id="intro">Hi</p>
CSS:
.big { color: blue; }
.big { color: orange; } (a) black (b) green (c) orange (d) blue - 25.True or false: margin is a solid or dotted edge. (a) True (b) False
- 26.True or false: HTML adds space around boxes. (a) False (b) True
-
27.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 60px;
padding: 10px;
border: 4px solid black;
margin: 5px;
} - 28.💪 Which justify-content value puts boxes in the middle? (a) space-between (b) flex-start (c) center (d) flex-end
- 29.🌈 What is the biggest number one colour can have in rgb()? (a) 100 (b) 99 (c) 1000 (d) 255
-
30.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 768px) {
p {
font-size: 10px;
}
} -
31.✍️ What value is given to padding in this rule?
li {
font-size: 20px;
padding: 8px;
} (a) 2px solid (b) padding (c) 8px (d) bold - 32.🎯 How many elements on a page should have the same id? (a) 2 (b) 5 (c) 1 (d) any number
-
33.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 410px;
justify-content: space-between;
}
Inside are 4 boxes, each 80px wide (no margins). -
34.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (min-width: 768px) {
p {
font-size: 20px;
}
} (a) Yes (b) No - 35.📦 In the box model, which part is the text or picture? (a) padding (b) margin (c) content (d) border
- 36.🔍 Which is the odd one out? (a) makes a link (b) counts down a timer (c) puts a picture on a page (d) makes a form box
- 37.🖌️ Which CSS property picks the font style? (a) font-weight (b) color (c) font-family (d) text-align
-
38.✍️ What is the selector in this CSS rule?
p {
font-style: italic;
text-align: center;
} (a) center (b) p (c) font-style (d) .note -
39.📱 The screen is 414px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (min-width: 768px) {
p {
font-size: 18px;
}
} (a) Yes (b) No -
40.✍️ How many declarations (property: value pairs) are in this rule?
h2 {
padding: 8px;
}
Answer key
- font-style
- bright green
- shows a pop-up message
- :
- p
- Yes
- Yes
- a class selector
- sets the letter colour
- green
- True
- blue
- yellow
- <div id="intro">
- False
- gives the page structure
- <link>
- 2
- 16
- orange
- 20px
- <div class="box">
- lays out the page
- orange
- False
- False
- 98
- center
- 255
- 10
- 8px
- 1
- 30
- No
- content
- counts down a timer
- font-family
- p
- No
- 1
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids