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) reacts to a button click (b) makes a form box (c) makes headings and lists (d) makes a link
- 2.✍️ In color: blue; which part is the property? (a) : (b) blue (c) ; (d) color
- 3.🖌️ Which CSS property sets the letter colour? (a) font-weight (b) font-family (c) font-size (d) color
- 4.🖌️ Which CSS property centres a heading? (a) font-family (b) text-align (c) font-weight (d) color
- 5.🎯 Can many elements share the same class? (a) Yes (b) No
-
6.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 1024px) {
p {
font-size: 8px;
}
} -
7.🖌️ How big is the text, in px?
h1 {
font-size: 12px;
text-align: left;
background-color: purple;
color: blue;
} - 8.Which of these does CSS do? (a) sets colours and fonts (b) gives the page structure (c) changes the page live (d) reacts to a button click
- 9.⚖️ Which selector is the strongest? (a) an element selector (b) a class selector (c) an id selector
-
10.⚖️ What colour is the text of this element?
<p class="big" id="hero">Hi</p>
CSS:
p { color: red; }
.big { color: blue; }
#hero { color: green; } (a) blue (b) green (c) yellow (d) red -
11.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 480px) {
p {
font-size: 10px;
}
} (a) Yes (b) No - 12.✍️ CSS declarations go inside which brackets? (a) < > (b) [ ] (c) ( ) (d) { }
-
13.⚖️ What colour is the text of this element?
<h1 class="big" id="main">Hi</h1>
CSS:
#main { color: blue; }
#main { color: white; } (a) white (b) black (c) blue (d) purple -
14.✍️ Which property is set to 2px solid in this rule?
.box {
font-weight: bold;
border: 2px solid;
} (a) border (b) font-style (c) 2px solid (d) width - 15.📱 Responsive design means a page ___. (a) never changes (b) has no pictures (c) is only for laptops (d) fits every screen
-
16.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (max-width: 600px) {
p {
font-size: 22px;
}
} - 17.What does justify-content: flex-end do? (a) packs boxes at the start (b) packs boxes at the end (c) equal gaps, none at ends (d) puts boxes in the middle
-
18.✍️ Which property is set to center in this rule?
h2 {
margin: 10px;
font-size: 20px;
text-align: center;
} (a) center (b) margin (c) background-color (d) text-align - 19.🎨 Which attribute adds CSS inside one tag? (a) alt (b) src (c) href (d) style
-
20.✍️ Which property is set to 20px in this rule?
#top {
font-style: italic;
font-weight: bold;
font-size: 20px;
} (a) text-align (b) 20px (c) background-color (d) font-size - 21.🖌️ Which CSS property colours behind the text? (a) color (b) font-family (c) text-align (d) background-color
-
22.✍️ How many declarations (property: value pairs) are in this rule?
body {
color: red;
font-size: 20px;
width: 300px;
border: 2px solid;
} -
23.🖌️ Where does the text sit on its line?
li {
font-size: 16px;
text-align: right;
color: black;
background-color: yellow;
} (a) on the right (b) in the middle (c) on the left - 24.🌈 Which hex code is cyan? (a) #00ffff (b) #000000 (c) #ff00ff (d) #ff0000
- 25.What does font-size do? (a) makes letters bigger (b) sets the letter colour (c) colours behind the text (d) centres a heading
- 26.🌈 In #rrggbb, which colour do the first two digits give? (a) blue (b) black (c) green (d) red
-
27.📱 The screen is 540px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 480px) {
p {
font-size: 12px;
}
} (a) No (b) Yes - 28.🖌️ Which CSS property makes the text bold? (a) font-weight (b) font-family (c) text-align (d) color
- 29.🖌️ Which CSS property picks the font style? (a) color (b) font-weight (c) font-family (d) background-color
- 30.True or false: .card is an element selector. (a) False (b) True
- 31.🌈 In #00000e the blue part is the hex number 0e. What is it as a normal number?
-
32.⚖️ What colour is the text of this element?
<p class="box" id="intro">Hi</p>
CSS:
p { color: white; }
p { color: orange; } (a) white (b) green (c) black (d) orange -
33.🖌️ What colour are the letters?
h1 {
color: black;
font-size: 24px;
background-color: orange;
text-align: center;
} (a) yellow (b) black (c) orange - 34.True or false: CSS makes a link. (a) False (b) True
-
35.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 50px;
padding: 25px;
border: 4px solid black;
margin: 0px;
} -
36.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 560px;
justify-content: center;
}
Inside are 4 boxes, each 100px wide (no margins). -
37.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 100px;
padding: 10px;
border: 2px solid black;
margin: 0px;
} - 38.🌈 Which hex code is magenta? (a) #00ffff (b) #ff00ff (c) #0000ff (d) #ff0000
- 39.🌈 Which colour is #000000? (a) white (b) cyan (c) black (d) bright green
- 40.🌈 Which colour is rgb(255, 0, 0)? (a) magenta (b) black (c) blue (d) red
Answer key
- reacts to a button click
- color
- color
- text-align
- Yes
- 8
- 12
- sets colours and fonts
- an id selector
- green
- Yes
- { }
- white
- border
- fits every screen
- 22
- packs boxes at the end
- text-align
- style
- font-size
- background-color
- 4
- on the right
- #00ffff
- makes letters bigger
- red
- No
- font-weight
- font-family
- False
- 14
- orange
- black
- False
- 108
- 80
- 124
- #ff00ff
- black
- red
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids