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.🌈 In #00e500 the green part is the hex number e5. What is it as a normal number?
- 2.💪 Which flexbox property turns on flexbox? (a) gap (b) align-items (c) flex-direction (d) display: flex
-
3.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 190px;
justify-content: flex-start;
}
Inside are 2 boxes, each 80px wide (no margins). - 4.🧩 Which language makes a link? (a) CSS (b) JavaScript (c) HTML
-
5.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 340px;
justify-content: flex-end;
}
Inside are 3 boxes, each 100px wide (no margins). -
6.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 60px;
padding: 20px;
border: 4px solid black;
margin: 5px;
} - 7.🌈 Which colour is #00ffff? (a) cyan (b) red (c) blue (d) magenta
-
8.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (min-width: 768px) {
p {
font-size: 22px;
}
} (a) No (b) Yes -
9.📱 The screen is 414px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (min-width: 600px) {
p {
font-size: 26px;
}
} (a) Yes (b) No - 10.True or false: padding is the gap to other boxes. (a) True (b) False
- 11.🌈 Which colour of light is strongest in rgb(71, 176, 103)? (a) red (b) blue (c) green
-
12.🎯 Which CSS selector matches this element?
<li class="box" id="hero">Hello</li> (a) .hero (b) li (c) .star (d) div - 13.🎯 What kind of selector is #logo? (a) an id selector (b) an element selector (c) a class selector
- 14.🎨 One CSS file can style how many pages? (a) only one word (b) no pages (c) only one image (d) many pages
-
15.⚖️ What colour is the text of this element?
<p class="note" id="end">Hi</p>
CSS:
#end { color: white; }
p { color: green; } (a) green (b) purple (c) orange (d) white - 16.🎯 Which element does the selector p style? (a) <li id="logo"> (b) <h2 class="star"> (c) <h1> (d) <p class="star">
- 17.🎯 What kind of selector is .star? (a) an id selector (b) a class selector (c) an element selector
- 18.🖌️ Which CSS property makes letters bigger? (a) font-size (b) font-weight (c) font-family (d) color
-
19.⚖️ What colour is the text of this element?
<p class="big" id="top">Hi</p>
CSS:
p { color: yellow; }
p { color: orange; } (a) yellow (b) red (c) orange (d) blue - 20.📦 In the box model, which part is the line round the box? (a) content (b) border (c) padding (d) margin
-
21.⚖️ What colour is the text of this element?
<p class="red" id="main">Hi</p>
CSS:
.red { color: red; }
.red { color: white; } (a) white (b) blue (c) red (d) orange - 22.🎯 Which sign starts a class selector? (a) & (b) # (c) . (d) @
-
23.📦 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: 15px;
border: 5px solid black;
margin: 0px;
} -
24.🖌️ What colour is behind the letters?
p {
font-size: 36px;
color: green;
text-align: right;
background-color: purple;
} (a) green (b) purple (c) orange - 25.✍️ How does a CSS comment start? (a) # (b) <!-- (c) // (d) /*
- 26.🌈 Which colour is rgb(255, 0, 0)? (a) bright green (b) blue (c) red (d) cyan
-
27.📱 The screen is 414px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 600px) {
p {
font-size: 10px;
}
} (a) No (b) Yes - 28.What does justify-content: space-between do? (a) equal gaps, none at ends (b) packs boxes at the start (c) packs boxes at the end (d) puts boxes in the middle
-
29.🎯 Which CSS selector matches this element?
<p class="menu" id="main">Hello</p> (a) .note (b) h1 (c) #menu (d) p -
30.🖌️ What colour is behind the letters?
p {
text-align: center;
background-color: red;
color: orange;
font-size: 32px;
} (a) red (b) orange (c) black - 31.🌈 In #rrggbb, which colour do the last two digits give? (a) green (b) blue (c) white (d) red
- 32.🔍 Which is the odd one out? (a) lays out the page (b) changes the page live (c) counts down a timer (d) checks a quiz answer
-
33.⚖️ What colour is the text of this element?
<h2 class="note" id="logo">Hi</h2>
CSS:
.note { color: purple; }
#logo { color: orange; }
h2 { color: black; } (a) orange (b) purple (c) black (d) yellow - 34.True or false: JavaScript reacts to a button click. (a) True (b) False
-
35.✍️ How many declarations (property: value pairs) are in this rule?
h2 {
width: 300px;
} - 36.🎨 Which tag connects an outside CSS file? (a) <a> (b) <link> (c) <css> (d) <img>
- 37.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the first one (b) neither (c) the later one (d) the shorter one
-
38.⚖️ What colour is the text of this element?
<h1 class="menu" id="end">Hi</h1>
CSS:
.menu { color: black; }
.menu { color: red; } (a) red (b) orange (c) blue (d) black - 39.🌈 Which colour is rgb(0, 255, 255)? (a) bright green (b) yellow (c) cyan (d) red
-
40.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 360px;
justify-content: space-between;
}
Inside are 3 boxes, each 80px wide (no margins).
Answer key
- 229
- display: flex
- 30
- HTML
- 40
- 118
- cyan
- No
- No
- False
- green
- li
- an id selector
- many pages
- white
- <p class="star">
- a class selector
- font-size
- orange
- border
- white
- .
- 90
- purple
- /*
- red
- Yes
- equal gaps, none at ends
- p
- red
- blue
- lays out the page
- orange
- True
- 1
- <link>
- the later one
- red
- cyan
- 60
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids