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.🌈 Hex digits go 0 to 9, then A to which letter? (a) Z (b) F (c) G (d) J
- 2.🌈 Which colour is #ff0000? (a) red (b) white (c) bright green (d) magenta
- 3.🎯 Which sign starts an id selector? (a) & (b) @ (c) # (d) .
- 4.🌈 Which colour of light is strongest in rgb(235, 112, 26)? (a) green (b) blue (c) red
-
5.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 280px;
padding: 20px;
border: 3px solid black;
margin: 5px;
} - 6.True or false: .star is a class selector. (a) True (b) False
-
7.✍️ What is the selector in this CSS rule?
p {
font-weight: bold;
width: 300px;
text-align: center;
} (a) p (b) .note (c) font-weight (d) 300px -
8.⚖️ What colour is the text of this element?
<p class="big" id="intro">Hi</p>
CSS:
.big { color: white; }
.big { color: blue; } (a) white (b) red (c) black (d) blue - 9.🎯 Which element does the selector div style? (a) <div class="note"> (b) <p class="note"> (c) <span> (d) <h1 id="hero">
- 10.💪 Which justify-content value equal gaps, none at ends? (a) flex-start (b) flex-end (c) space-between (d) center
- 11.True or false: CSS changes the text size. (a) True (b) False
-
12.⚖️ What colour is the text of this element?
<h1 class="star" id="hero">Hi</h1>
CSS:
.star { color: white; }
.star { color: orange; } (a) orange (b) red (c) white (d) purple -
13.🖌️ What colour are the letters?
h1 {
font-size: 36px;
text-align: center;
background-color: purple;
color: red;
} (a) red (b) blue (c) purple - 14.What does color do? (a) picks the font style (b) sets the letter colour (c) centres a heading (d) makes letters bigger
-
15.⚖️ What colour is the text of this element?
<h1 class="big" id="hero">Hi</h1>
CSS:
#hero { color: orange; }
#hero { color: red; } (a) red (b) green (c) white (d) orange -
16.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 70px;
padding: 15px;
border: 4px solid black;
margin: 5px;
} - 17.What does justify-content: flex-end do? (a) equal gaps, none at ends (b) packs boxes at the start (c) puts boxes in the middle (d) packs boxes at the end
- 18.True or false: padding is space inside the border. (a) True (b) False
- 19.🎨 Which tag holds CSS inside the head? (a) <css> (b) <script> (c) <body> (d) <style>
- 20.📱 Which tag helps phones show a page at the right size? (a) the viewport meta tag (b) the title tag (c) the hr tag (d) the br tag
- 21.True or false: li is an id selector. (a) True (b) False
- 22.🖌️ Which CSS property makes letters bigger? (a) color (b) text-align (c) font-family (d) font-size
-
23.⚖️ What colour is the text of this element?
<h2 class="menu" id="intro">Hi</h2>
CSS:
.menu { color: black; }
#intro { color: blue; } (a) black (b) orange (c) white (d) blue -
24.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 230px;
justify-content: flex-end;
}
Inside are 4 boxes, each 40px wide (no margins). - 25.✍️ How does a CSS comment start? (a) # (b) /* (c) // (d) <!--
- 26.What does font-weight do? (a) colours behind the text (b) makes the text bold (c) picks the font style (d) sets the letter colour
- 27.📱 What does a media query check? (a) the time of day (b) the screen width (c) the battery level (d) the page title
- 28.⚖️ Which selector is the weakest? (a) a class selector (b) an element selector (c) an id selector
- 29.🖌️ Which CSS property centres a heading? (a) text-align (b) color (c) font-size (d) font-weight
- 30.📦 In the box model, which part is space outside the border? (a) padding (b) content (c) margin (d) border
-
31.🖌️ What colour is behind the letters?
li {
text-align: left;
background-color: green;
font-size: 32px;
color: purple;
} (a) purple (b) green (c) black -
32.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 768px) {
p {
font-size: 26px;
}
} -
33.📱 The screen is 820px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 768px) {
p {
font-size: 14px;
}
} (a) No (b) Yes - 34.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the later one (c) the shorter one (d) the first one
- 35.True or false: #top is an id selector. (a) True (b) False
-
36.✍️ What is the selector in this CSS rule?
.box {
background-color: yellow;
padding: 8px;
} (a) h2 (b) 8px (c) background-color (d) .box - 37.🌈 Which colour of light is strongest in rgb(26, 227, 45)? (a) blue (b) red (c) green
- 38.🌈 In #002b00 the green part is the hex number 2b. What is it as a normal number?
-
39.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (min-width: 600px) {
p {
font-size: 14px;
}
} - 40.🧩 Which language changes the text size? (a) CSS (b) JavaScript (c) HTML
Answer key
- F
- red
- #
- red
- 326
- True
- p
- blue
- <div class="note">
- space-between
- True
- orange
- red
- sets the letter colour
- red
- 118
- packs boxes at the end
- True
- <style>
- the viewport meta tag
- False
- font-size
- blue
- 70
- /*
- makes the text bold
- the screen width
- an element selector
- text-align
- margin
- green
- 24
- No
- the later one
- True
- .box
- green
- 43
- 12
- CSS
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids