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.True or false: HTML makes a link. (a) True (b) False
- 2.🧩 Which language adds space around boxes? (a) JavaScript (b) HTML (c) CSS
- 3.🧩 Which language makes headings and lists? (a) CSS (b) JavaScript (c) HTML
- 4.🌈 Which colour is #ff00ff? (a) red (b) white (c) magenta (d) black
- 5.🎯 What kind of selector is body? (a) an element selector (b) a class selector (c) an id selector
- 6.🧩 Which language puts a picture on a page? (a) CSS (b) JavaScript (c) HTML
-
7.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 210px;
justify-content: flex-start;
}
Inside are 2 boxes, each 100px wide (no margins). - 8.🌈 Hex digits go 0 to 9, then A to which letter? (a) J (b) Z (c) G (d) F
- 9.🌈 Which hex code is black? (a) #ffff00 (b) #ff0000 (c) #000000 (d) #00ffff
- 10.🖌️ Which CSS property makes the text bold? (a) text-align (b) background-color (c) color (d) font-weight
- 11.🌈 In #002700 the green part is the hex number 27. What is it as a normal number?
-
12.✍️ What is the selector in this CSS rule?
h2 {
font-size: 20px;
font-style: italic;
font-weight: bold;
} (a) italic (b) font-size (c) h2 (d) h1 - 13.Which of these does CSS do? (a) gives the page structure (b) sets colours and fonts (c) checks a quiz answer (d) makes a form box
- 14.🌈 In #380000 the red part is the hex number 38. What is it as a normal number?
-
15.🖌️ Where does the text sit on its line?
h1 {
background-color: yellow;
text-align: left;
font-size: 16px;
color: purple;
} (a) on the left (b) in the middle (c) on the right - 16.📱 min-width: 800px applies when the screen is ___. (a) exactly 100px (b) turned off (c) 800px or narrower (d) 800px or wider
-
17.✍️ What value is given to text-align in this rule?
body {
width: 300px;
text-align: center;
} (a) text-align (b) center (c) yellow (d) 10px - 18.🌈 In #rrggbb, which colour do the first two digits give? (a) blue (b) red (c) black (d) green
- 19.🌈 Which hex code is red? (a) #00ffff (b) #ff0000 (c) #000000 (d) #0000ff
-
20.🖌️ What colour are the letters?
li {
background-color: red;
font-size: 16px;
text-align: right;
color: yellow;
} (a) red (b) yellow (c) white - 21.🌈 What is the biggest number one colour can have in rgb()? (a) 99 (b) 255 (c) 1000 (d) 100
- 22.True or false: img is an element selector. (a) False (b) True
- 23.🎯 What kind of selector is .star? (a) an id selector (b) an element selector (c) a class selector
-
24.✍️ What value is given to font-weight in this rule?
body {
padding: 8px;
font-size: 20px;
font-weight: bold;
} (a) 300px (b) bold (c) 2px solid (d) font-weight -
25.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 1024px) {
p {
font-size: 24px;
}
} - 26.📦 In the box model, which part is the gap to other boxes? (a) margin (b) border (c) content (d) padding
-
27.🎯 Which CSS selector matches this element?
<h1 class="red" id="top">Hello</h1> (a) .top (b) #intro (c) #red (d) .red -
28.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 230px;
padding: 5px;
border: 3px solid black;
margin: 0px;
} -
29.⚖️ What colour is the text of this element?
<h1 class="box" id="end">Hi</h1>
CSS:
h1 { color: green; }
.box { color: blue; } (a) green (b) purple (c) blue (d) orange - 30.🌈 In #rrggbb, which colour do the last two digits give? (a) white (b) green (c) red (d) blue
- 31.🧩 Which language makes a link? (a) CSS (b) JavaScript (c) HTML
- 32.🖌️ Which CSS property makes letters bigger? (a) text-align (b) background-color (c) font-weight (d) font-size
- 33.💪 Which flexbox property sets space between boxes? (a) justify-content (b) display: flex (c) gap (d) flex-direction
- 34.True or false: .star is a class selector. (a) True (b) False
- 35.True or false: body is an id selector. (a) True (b) False
- 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: 12px;
}
@media (max-width: 600px) {
p {
font-size: 10px;
}
} (a) Yes (b) No - 38.🖌️ Which CSS property colours behind the text? (a) font-size (b) text-align (c) background-color (d) font-weight
- 39.🌈 Which colour is rgb(0, 0, 255)? (a) black (b) bright green (c) blue (d) red
- 40.True or false: CSS gives the page structure. (a) False (b) True
Answer key
- True
- CSS
- HTML
- magenta
- an element selector
- HTML
- 10
- F
- #000000
- font-weight
- 39
- h2
- sets colours and fonts
- 56
- on the left
- 800px or wider
- center
- red
- #ff0000
- yellow
- 255
- True
- a class selector
- bold
- 24
- margin
- .red
- 246
- blue
- blue
- HTML
- font-size
- gap
- True
- False
- /*
- No
- background-color
- blue
- False
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids