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 hex code is bright green? (a) #00ff00 (b) #0000ff (c) #ffff00 (d) #ff0000
-
2.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 480px) {
p {
font-size: 12px;
}
} -
3.✍️ What is the selector in this CSS rule?
.box {
color: red;
font-size: 20px;
padding: 8px;
} (a) 20px (b) .box (c) color (d) h2 - 4.⚖️ Which selector is the weakest? (a) a class selector (b) an element selector (c) an id selector
-
5.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 350px;
justify-content: flex-end;
}
Inside are 3 boxes, each 100px wide (no margins). - 6.True or false: .card is an id selector. (a) True (b) False
-
7.🖌️ What colour is behind the letters?
p {
background-color: orange;
font-size: 12px;
text-align: left;
color: green;
} (a) green (b) orange (c) black - 8.🔍 Which is the odd one out? (a) adds space around boxes (b) checks a quiz answer (c) lays out the page (d) sets colours and fonts
-
9.⚖️ What colour is the text of this element?
<h2 class="box" id="hero">Hi</h2>
CSS:
.box { color: purple; }
.box { color: red; } (a) purple (b) red (c) orange (d) yellow - 10.📱 max-width: 600px applies when the screen is ___. (a) turned off (b) exactly 1000px (c) 600px or wider (d) 600px or narrower
-
11.🖌️ Where does the text sit on its line?
h1 {
text-align: right;
color: red;
font-size: 32px;
background-color: purple;
} (a) on the right (b) in the middle (c) on the left -
12.🖌️ How big is the text, in px?
h1 {
font-size: 36px;
color: red;
text-align: left;
background-color: blue;
} -
13.✍️ What is the selector in this CSS rule?
li {
border: 2px solid;
text-align: center;
font-size: 20px;
width: 300px;
} (a) border (b) center (c) body (d) li - 14.True or false: HTML lays out the page. (a) True (b) False
- 15.True or false: HTML checks a quiz answer. (a) True (b) False
-
16.💪 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). - 17.🔍 Which is the odd one out? (a) sets colours and fonts (b) adds space around boxes (c) makes a link (d) changes the text size
-
18.✍️ What value is given to font-weight in this rule?
.note {
text-align: center;
font-weight: bold;
} (a) bold (b) font-weight (c) 300px (d) 2px solid - 19.📱 What does a media query check? (a) the page title (b) the screen width (c) the time of day (d) the battery level
- 20.True or false: HTML gives the page structure. (a) False (b) True
- 21.🧩 Which language makes a link? (a) JavaScript (b) HTML (c) CSS
- 22.True or false: padding is the gap round content. (a) False (b) True
-
23.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 768px) {
p {
font-size: 18px;
}
} -
24.⚖️ What colour is the text of this element?
<p class="big" id="main">Hi</p>
CSS:
#main { color: white; }
p { color: yellow; }
.big { color: purple; } (a) purple (b) yellow (c) orange (d) white -
25.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 200px;
justify-content: center;
}
Inside are 2 boxes, each 50px wide (no margins). - 26.🖌️ Which CSS property sets the letter colour? (a) font-family (b) font-size (c) background-color (d) color
- 27.🎯 Which element does the selector h1 style? (a) <li class="big"> (b) <div id="top"> (c) <h2> (d) <h1 class="big">
-
28.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 190px;
justify-content: flex-start;
}
Inside are 2 boxes, each 80px wide (no margins). - 29.🖌️ Which CSS property makes letters bigger? (a) font-size (b) color (c) font-family (d) background-color
- 30.🌈 Which colour is rgb(0, 0, 0)? (a) red (b) black (c) magenta (d) bright green
-
31.⚖️ What colour is the text of this element?
<p class="big" id="intro">Hi</p>
CSS:
p { color: green; }
.big { color: red; } (a) green (b) orange (c) purple (d) red -
32.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 1024px) {
p {
font-size: 6px;
}
} - 33.🌈 Which hex code is white? (a) #ffff00 (b) #ffffff (c) #00ffff (d) #0000ff
- 34.🎨 Which tag connects an outside CSS file? (a) <link> (b) <css> (c) <img> (d) <a>
- 35.🌈 Which hex code is blue? (a) #00ffff (b) #000000 (c) #ff0000 (d) #0000ff
-
36.✍️ Which property is set to 8px in this rule?
p {
padding: 8px;
font-weight: bold;
margin: 10px;
} (a) padding (b) font-weight (c) 8px (d) border - 37.True or false: .star is an id selector. (a) False (b) True
- 38.✍️ Which sign ends each CSS declaration? (a) ; (b) . (c) , (d) :
-
39.✍️ What value is given to text-align in this rule?
#top {
text-align: center;
width: 300px;
} (a) yellow (b) 10px (c) center (d) text-align -
40.⚖️ What colour is the text of this element?
<h1 class="box" id="hero">Hi</h1>
CSS:
#hero { color: orange; }
#hero { color: yellow; } (a) white (b) yellow (c) red (d) orange
Answer key
- #00ff00
- 16
- .box
- an element selector
- 50
- False
- orange
- checks a quiz answer
- red
- 600px or narrower
- on the right
- 36
- li
- False
- False
- 70
- makes a link
- bold
- the screen width
- True
- HTML
- True
- 18
- white
- 50
- color
- <h1 class="big">
- 30
- font-size
- black
- red
- 6
- #ffffff
- <link>
- #0000ff
- padding
- False
- ;
- center
- yellow
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids