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 is the odd one out? (a) puts a picture on a page (b) makes a link (c) gives the page structure (d) adds space around boxes
-
2.✍️ What value is given to font-weight in this rule?
p {
font-weight: bold;
color: red;
text-align: center;
} (a) 300px (b) font-weight (c) 2px solid (d) bold - 3.True or false: body is an element selector. (a) True (b) False
-
4.⚖️ What colour is the text of this element?
<h1 class="box" id="logo">Hi</h1>
CSS:
#logo { color: black; }
#logo { color: blue; } (a) black (b) yellow (c) blue (d) white - 5.🌈 Which colour is rgb(0, 0, 255)? (a) yellow (b) blue (c) black (d) bright green
-
6.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 480px) {
p {
font-size: 14px;
}
} -
7.🎯 Which CSS selector matches this element?
<h1 class="big" id="hero">Hello</h1> (a) .hero (b) #hero (c) #big (d) .red -
8.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 440px;
justify-content: space-between;
}
Inside are 3 boxes, each 100px wide (no margins). -
9.✍️ What value is given to background-color in this rule?
p {
background-color: yellow;
color: red;
font-size: 20px;
} (a) 10px (b) background-color (c) yellow (d) 8px - 10.💪 Which justify-content value packs boxes at the start? (a) flex-start (b) space-between (c) center (d) flex-end
- 11.🧩 Which language counts down a timer? (a) CSS (b) HTML (c) JavaScript
- 12.⚖️ Which selector is the strongest? (a) an element selector (b) an id selector (c) a class selector
- 13.🎯 Which element does the selector h1 style? (a) <li class="big"> (b) <div id="main"> (c) <h1 class="big"> (d) <h2>
- 14.🎨 Which tag connects an outside CSS file? (a) <img> (b) <a> (c) <link> (d) <css>
- 15.What does font-family do? (a) colours behind the text (b) makes letters bigger (c) sets the letter colour (d) picks the font style
- 16.🖌️ Which CSS property colours behind the text? (a) font-weight (b) font-family (c) background-color (d) color
-
17.✍️ What value is given to font-weight in this rule?
.box {
text-align: center;
font-weight: bold;
} (a) bold (b) font-weight (c) 300px (d) 2px solid - 18.Which of these does HTML do? (a) shows a pop-up message (b) changes the page live (c) makes a form box (d) lays out the page
- 19.What does background-color do? (a) makes letters bigger (b) centres a heading (c) colours behind the text (d) makes the text bold
- 20.✍️ In color: blue; which part is the property? (a) ; (b) color (c) blue (d) :
-
21.🖌️ What colour are the letters?
p {
font-size: 16px;
text-align: center;
color: blue;
background-color: yellow;
} (a) white (b) blue (c) yellow - 22.🌈 Which colour of light is strongest in rgb(56, 205, 75)? (a) green (b) red (c) blue
-
23.✍️ What is the selector in this CSS rule?
p {
font-style: italic;
background-color: yellow;
text-align: center;
padding: 8px;
} (a) yellow (b) font-style (c) p (d) .note - 24.🌈 Which colour is #00ff00? (a) red (b) white (c) magenta (d) bright green
- 25.📦 In the box model, which part is space inside the border? (a) content (b) border (c) padding (d) margin
-
26.⚖️ What colour is the text of this element?
<h1 class="note" id="hero">Hi</h1>
CSS:
h1 { color: orange; }
h1 { color: white; } (a) white (b) purple (c) orange (d) yellow -
27.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 180px;
padding: 10px;
border: 5px solid black;
margin: 5px;
} - 28.True or false: HTML shows a pop-up message. (a) True (b) False
- 29.🌈 In #rrggbb, which colour do the first two digits give? (a) green (b) black (c) red (d) blue
-
30.✍️ What is the selector in this CSS rule?
h2 {
padding: 8px;
text-align: center;
} (a) h1 (b) h2 (c) center (d) padding -
31.✍️ How many declarations (property: value pairs) are in this rule?
.box {
color: red;
width: 300px;
margin: 10px;
text-align: center;
} -
32.🖌️ How big is the text, in px?
p {
text-align: left;
color: orange;
font-size: 12px;
background-color: red;
} - 33.Which of these does CSS do? (a) puts a picture on a page (b) sets colours and fonts (c) shows a pop-up message (d) checks a quiz answer
-
34.⚖️ What colour is the text of this element?
<h2 class="red" id="top">Hi</h2>
CSS:
.red { color: red; }
h2 { color: blue; } (a) blue (b) orange (c) red (d) green - 35.📱 Which tag helps phones show a page at the right size? (a) the br tag (b) the title tag (c) the viewport meta tag (d) the hr tag
- 36.🖌️ Which CSS property picks the font style? (a) font-size (b) background-color (c) font-family (d) font-weight
- 37.What does color do? (a) centres a heading (b) colours behind the text (c) makes the text bold (d) sets the letter colour
-
38.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 1024px) {
p {
font-size: 28px;
}
} (a) Yes (b) No - 39.🌈 What is the biggest number one colour can have in rgb()? (a) 255 (b) 100 (c) 1000 (d) 99
- 40.🎯 What kind of selector is .menu? (a) an element selector (b) an id selector (c) a class selector
Answer key
- adds space around boxes
- bold
- True
- blue
- blue
- 16
- #hero
- 70
- yellow
- flex-start
- JavaScript
- an id selector
- <h1 class="big">
- <link>
- picks the font style
- background-color
- bold
- makes a form box
- colours behind the text
- color
- blue
- green
- p
- bright green
- padding
- white
- 220
- False
- red
- h2
- 4
- 12
- sets colours and fonts
- red
- the viewport meta tag
- font-family
- sets the letter colour
- No
- 255
- a class selector
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids