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 colour is #000000? (a) magenta (b) blue (c) black (d) bright green
- 2.🎯 What kind of selector is p? (a) a class selector (b) an id selector (c) an element selector
- 3.🖌️ Which CSS property sets the letter colour? (a) color (b) font-family (c) text-align (d) background-color
- 4.🧩 Which language makes headings and lists? (a) CSS (b) JavaScript (c) HTML
-
5.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 200px;
padding: 20px;
border: 1px solid black;
margin: 5px;
} - 6.True or false: the border is the line round the box. (a) False (b) True
- 7.True or false: the content is a solid or dotted edge. (a) True (b) False
- 8.🧩 Which language rounds box corners? (a) CSS (b) JavaScript (c) HTML
- 9.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the later one (b) the first one (c) the shorter one (d) neither
- 10.✍️ CSS declarations go inside which brackets? (a) { } (b) ( ) (c) [ ] (d) < >
-
11.⚖️ What colour is the text of this element?
<h1 class="red" id="logo">Hi</h1>
CSS:
h1 { color: green; }
#logo { color: white; }
.red { color: red; } (a) red (b) green (c) yellow (d) white - 12.🎯 Which element does the selector li style? (a) <p id="intro"> (b) <li class="box"> (c) <span class="box"> (d) <div>
- 13.True or false: li is an element selector. (a) True (b) False
-
14.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 340px;
justify-content: center;
}
Inside are 2 boxes, each 100px wide (no margins). - 15.🎯 What kind of selector is .menu? (a) an id selector (b) a class selector (c) an element selector
-
16.🖌️ What colour are the letters?
li {
text-align: center;
background-color: red;
font-size: 28px;
color: green;
} (a) green (b) red (c) orange - 17.What does justify-content: flex-start do? (a) equal gaps, none at ends (b) packs boxes at the end (c) packs boxes at the start (d) puts boxes in the middle
- 18.⚖️ Which selector is the weakest? (a) an element selector (b) a class selector (c) an id selector
- 19.✍️ Which sign goes between a property and its value? (a) ; (b) : (c) - (d) =
- 20.🖌️ Which CSS property makes letters bigger? (a) color (b) text-align (c) font-family (d) font-size
-
21.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 480px) {
p {
font-size: 10px;
}
} - 22.📦 In the box model, which part is the line round the box? (a) margin (b) border (c) padding (d) content
-
23.✍️ What is the selector in this CSS rule?
body {
margin: 10px;
text-align: center;
} (a) .box (b) center (c) margin (d) body -
24.⚖️ What colour is the text of this element?
<p class="red" id="top">Hi</p>
CSS:
p { color: yellow; }
.red { color: orange; } (a) yellow (b) orange (c) black (d) white - 25.🌈 In #00e700 the green part is the hex number e7. What is it as a normal number?
- 26.Which of these does HTML do? (a) shows a pop-up message (b) gives the page structure (c) adds space around boxes (d) sets colours and fonts
- 27.🎨 Which tag connects an outside CSS file? (a) <img> (b) <a> (c) <css> (d) <link>
- 28.What does background-color do? (a) sets the letter colour (b) makes letters bigger (c) colours behind the text (d) centres a heading
-
29.✍️ What is the selector in this CSS rule?
body {
font-size: 20px;
background-color: yellow;
font-style: italic;
} (a) body (b) yellow (c) font-size (d) .box -
30.📱 The screen is 700px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (max-width: 1024px) {
p {
font-size: 18px;
}
} (a) No (b) Yes - 31.🌈 What is the biggest number one colour can have in rgb()? (a) 100 (b) 99 (c) 255 (d) 1000
- 32.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 4 (b) 2 (c) 3 (d) 6
- 33.Which of these does JavaScript do? (a) makes headings and lists (b) reacts to a button click (c) puts a picture on a page (d) sets colours and fonts
-
34.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 200px;
justify-content: space-between;
}
Inside are 2 boxes, each 60px wide (no margins). -
35.📱 The screen is 820px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 768px) {
p {
font-size: 30px;
}
} (a) Yes (b) No - 36.🖌️ Which CSS property picks the font style? (a) font-weight (b) color (c) font-family (d) font-size
- 37.🌈 In #0000a8 the blue part is the hex number a8. What is it as a normal number?
- 38.🎯 What kind of selector is .note? (a) a class selector (b) an id selector (c) an element selector
- 39.🌈 Which colour of light is strongest in rgb(81, 70, 251)? (a) red (b) green (c) blue
- 40.📱 What does a media query check? (a) the battery level (b) the page title (c) the time of day (d) the screen width
Answer key
- black
- an element selector
- color
- HTML
- 252
- True
- False
- CSS
- the later one
- { }
- white
- <li class="box">
- True
- 70
- a class selector
- green
- packs boxes at the start
- an element selector
- :
- font-size
- 10
- border
- body
- orange
- 231
- gives the page structure
- <link>
- colours behind the text
- body
- Yes
- 255
- 3
- reacts to a button click
- 80
- Yes
- font-family
- 168
- a class selector
- blue
- the screen width
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids