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 sign starts a class selector? (a) & (b) @ (c) # (d) .
-
2.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 400px;
justify-content: space-between;
}
Inside are 4 boxes, each 40px wide (no margins). - 3.True or false: padding is space inside the border. (a) False (b) True
- 4.🔍 Which is the odd one out? (a) checks a quiz answer (b) makes a link (c) counts down a timer (d) shows a pop-up message
- 5.✍️ In color: blue; which part is the property? (a) ; (b) : (c) color (d) blue
-
6.✍️ Which property is set to italic in this rule?
h1 {
margin: 10px;
text-align: center;
font-style: italic;
} (a) font-style (b) font-size (c) color (d) italic - 7.True or false: body is an element selector. (a) False (b) True
- 8.📱 Which tag helps phones show a page at the right size? (a) the br tag (b) the hr tag (c) the viewport meta tag (d) the title tag
-
9.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 600px) {
p {
font-size: 22px;
}
} - 10.🧩 Which language checks a quiz answer? (a) HTML (b) CSS (c) JavaScript
- 11.True or false: padding is the gap to other boxes. (a) True (b) False
-
12.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 480px) {
p {
font-size: 14px;
}
} -
13.✍️ Which property is set to 20px in this rule?
.box {
border: 2px solid;
color: red;
font-size: 20px;
} (a) 20px (b) background-color (c) font-size (d) text-align -
14.🖌️ Where does the text sit on its line?
li {
text-align: center;
color: green;
font-size: 40px;
background-color: purple;
} (a) in the middle (b) on the right (c) on the left - 15.🖌️ Which CSS property sets the letter colour? (a) color (b) background-color (c) font-size (d) font-family
- 16.🌈 Which colour is #0000ff? (a) black (b) blue (c) bright green (d) cyan
-
17.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 120px;
padding: 15px;
border: 4px solid black;
margin: 20px;
} - 18.🌈 Which hex code is bright green? (a) #00ff00 (b) #ff0000 (c) #ffff00 (d) #ffffff
- 19.🌈 In #007c00 the green part is the hex number 7c. What is it as a normal number?
- 20.Which of these does HTML do? (a) sets colours and fonts (b) reacts to a button click (c) puts a picture on a page (d) changes the page live
-
21.✍️ Which property is set to italic in this rule?
.box {
margin: 10px;
font-style: italic;
} (a) color (b) italic (c) font-style (d) font-size -
22.✍️ What value is given to text-align in this rule?
body {
font-style: italic;
font-weight: bold;
text-align: center;
} (a) text-align (b) yellow (c) center (d) 10px - 23.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 2 (b) 3 (c) 6 (d) 4
- 24.✍️ Which sign goes between a property and its value? (a) - (b) : (c) = (d) ;
-
25.🖌️ What colour is behind the letters?
p {
color: black;
text-align: right;
background-color: blue;
font-size: 40px;
} (a) blue (b) white (c) black -
26.⚖️ What colour is the text of this element?
<h1 class="big" id="logo">Hi</h1>
CSS:
h1 { color: green; }
#logo { color: yellow; } (a) green (b) yellow (c) purple (d) black - 27.🎯 What kind of selector is #logo? (a) an id selector (b) a class selector (c) an element selector
- 28.🎯 What kind of selector is #main? (a) a class selector (b) an id selector (c) an element selector
-
29.📱 The screen is 540px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (min-width: 768px) {
p {
font-size: 26px;
}
} (a) No (b) Yes - 30.Which of these does JavaScript do? (a) sets colours and fonts (b) adds space around boxes (c) checks a quiz answer (d) makes a form box
- 31.🎯 Which element does the selector .red style? (a) <h2 id="red"> (b) <h2 class="red"> (c) <h2 class="box"> (d) <li class="star">
- 32.What does font-weight do? (a) centres a heading (b) makes the text bold (c) sets the letter colour (d) picks the font style
- 33.🧩 Which language makes headings and lists? (a) JavaScript (b) CSS (c) HTML
- 34.🔍 Which is the odd one out? (a) makes headings and lists (b) puts a picture on a page (c) makes a form box (d) lays out the page
-
35.⚖️ What colour is the text of this element?
<h2 class="menu" id="hero">Hi</h2>
CSS:
h2 { color: red; }
h2 { color: white; } (a) red (b) white (c) black (d) orange - 36.🎯 Can many elements share the same class? (a) Yes (b) No
- 37.🧩 Which language reacts to a button click? (a) JavaScript (b) HTML (c) CSS
- 38.🎯 Which sign starts an id selector? (a) & (b) @ (c) # (d) .
- 39.✍️ How does a CSS comment start? (a) <!-- (b) // (c) /* (d) #
- 40.🌈 In #a10000 the red part is the hex number a1. What is it as a normal number?
Answer key
- .
- 80
- True
- makes a link
- color
- font-style
- True
- the viewport meta tag
- 22
- JavaScript
- False
- 16
- font-size
- in the middle
- color
- blue
- 198
- #00ff00
- 124
- puts a picture on a page
- font-style
- center
- 3
- :
- blue
- yellow
- an id selector
- an id selector
- No
- checks a quiz answer
- <h2 class="red">
- makes the text bold
- HTML
- lays out the page
- white
- Yes
- JavaScript
- #
- /*
- 161
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids