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.✍️ What value is given to text-align in this rule?
h1 {
text-align: center;
width: 300px;
} (a) text-align (b) center (c) 10px (d) yellow -
2.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 320px;
justify-content: center;
}
Inside are 3 boxes, each 60px wide (no margins). - 3.True or false: JavaScript counts down a timer. (a) True (b) False
- 4.🎯 Which sign starts a class selector? (a) . (b) # (c) @ (d) &
- 5.🎯 Can many elements share the same class? (a) No (b) Yes
-
6.⚖️ What colour is the text of this element?
<h1 class="menu" id="main">Hi</h1>
CSS:
#main { color: purple; }
#main { color: white; } (a) green (b) orange (c) purple (d) white - 7.🎨 Which attribute adds CSS inside one tag? (a) alt (b) src (c) style (d) href
-
8.⚖️ What colour is the text of this element?
<p class="note" id="end">Hi</p>
CSS:
p { color: purple; }
p { color: red; } (a) black (b) purple (c) red (d) orange -
9.📱 The screen is 414px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (min-width: 768px) {
p {
font-size: 20px;
}
} (a) Yes (b) No -
10.⚖️ What colour is the text of this element?
<h2 class="menu" id="top">Hi</h2>
CSS:
h2 { color: yellow; }
.menu { color: blue; } (a) orange (b) blue (c) yellow (d) white -
11.📱 The screen is 820px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 1024px) {
p {
font-size: 26px;
}
} (a) No (b) Yes - 12.💪 Which flexbox property lines boxes up across? (a) flex-direction (b) display: flex (c) align-items (d) justify-content
- 13.Which of these does JavaScript do? (a) adds space around boxes (b) changes the text size (c) reacts to a button click (d) rounds box corners
-
14.✍️ Which property is set to bold in this rule?
li {
background-color: yellow;
font-weight: bold;
width: 300px;
} (a) border (b) bold (c) font-weight (d) width - 15.🎯 How many elements on a page should have the same id? (a) any number (b) 2 (c) 1 (d) 5
-
16.✍️ How many declarations (property: value pairs) are in this rule?
li {
font-style: italic;
padding: 8px;
margin: 10px;
background-color: yellow;
} -
17.🎯 Which CSS selector matches this element?
<h2 class="box" id="top">Hello</h2> (a) #box (b) h2 (c) .top (d) li - 18.🧩 Which language changes the page live? (a) CSS (b) HTML (c) JavaScript
-
19.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (min-width: 768px) {
p {
font-size: 14px;
}
} - 20.🖌️ Which CSS property colours behind the text? (a) background-color (b) color (c) text-align (d) font-weight
- 21.✍️ In color: blue; which part is the property? (a) : (b) blue (c) color (d) ;
- 22.🔍 Which is the odd one out? (a) makes headings and lists (b) gives the page structure (c) reacts to a button click (d) makes a link
-
23.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 210px;
padding: 10px;
border: 4px solid black;
margin: 20px;
} -
24.✍️ How many declarations (property: value pairs) are in this rule?
h2 {
background-color: yellow;
font-weight: bold;
text-align: center;
font-size: 20px;
} -
25.✍️ What is the selector in this CSS rule?
.box {
margin: 10px;
border: 2px solid;
background-color: yellow;
padding: 8px;
} (a) h2 (b) margin (c) 2px solid (d) .box - 26.True or false: .star is an element selector. (a) True (b) False
- 27.✍️ Which sign ends each CSS declaration? (a) . (b) ; (c) : (d) ,
- 28.🖌️ Which CSS property centres a heading? (a) font-size (b) text-align (c) font-weight (d) background-color
-
29.⚖️ What colour is the text of this element?
<h2 class="big" id="end">Hi</h2>
CSS:
.big { color: orange; }
#end { color: blue; } (a) blue (b) red (c) green (d) orange -
30.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 110px;
padding: 25px;
border: 2px solid black;
margin: 5px;
} -
31.⚖️ What colour is the text of this element?
<h1 class="big" id="intro">Hi</h1>
CSS:
#intro { color: blue; }
#intro { color: green; } (a) black (b) green (c) blue (d) orange -
32.🎯 Which CSS selector matches this element?
<li class="big" id="hero">Hello</li> (a) #top (b) div (c) .red (d) #hero -
33.✍️ How many declarations (property: value pairs) are in this rule?
.box {
font-style: italic;
font-weight: bold;
background-color: yellow;
border: 2px solid;
} -
34.⚖️ What colour is the text of this element?
<p class="menu" id="top">Hi</p>
CSS:
.menu { color: red; }
p { color: purple; }
#top { color: green; } (a) red (b) green (c) white (d) purple - 35.🔍 Which is the odd one out? (a) checks a quiz answer (b) puts a picture on a page (c) makes headings and lists (d) makes a link
- 36.✍️ How does a CSS comment start? (a) <!-- (b) // (c) /* (d) #
-
37.📱 The screen is 820px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 768px) {
p {
font-size: 26px;
}
} (a) Yes (b) No - 38.Which of these does JavaScript do? (a) changes the text size (b) checks a quiz answer (c) makes a link (d) adds space around boxes
-
39.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 768px) {
p {
font-size: 26px;
}
} -
40.🖌️ What colour is behind the letters?
h2 {
font-size: 20px;
background-color: red;
color: white;
text-align: left;
} (a) white (b) red (c) blue
Answer key
- center
- 70
- True
- .
- Yes
- white
- style
- red
- No
- blue
- No
- align-items
- reacts to a button click
- font-weight
- 1
- 4
- h2
- JavaScript
- 14
- background-color
- color
- reacts to a button click
- 238
- 4
- .box
- False
- ;
- text-align
- blue
- 174
- green
- #hero
- 4
- green
- checks a quiz answer
- /*
- Yes
- checks a quiz answer
- 24
- red
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids