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.⚖️ What colour is the text of this element?
<p class="note" id="end">Hi</p>
CSS:
.note { color: red; }
.note { color: black; } (a) black (b) blue (c) orange (d) red -
2.🖌️ Where does the text sit on its line?
h1 {
font-size: 40px;
color: green;
background-color: blue;
text-align: left;
} (a) on the left (b) in the middle (c) on the right - 3.🧩 Which language puts a picture on a page? (a) HTML (b) CSS (c) JavaScript
- 4.🔍 Which is the odd one out? (a) puts a picture on a page (b) counts down a timer (c) checks a quiz answer (d) changes the page live
- 5.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 2 (b) 4 (c) 3 (d) 6
-
6.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 200px;
padding: 30px;
border: 3px solid black;
margin: 0px;
} -
7.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (min-width: 480px) {
p {
font-size: 20px;
}
} (a) No (b) Yes -
8.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (min-width: 1024px) {
p {
font-size: 18px;
}
} (a) Yes (b) No - 9.💪 Which justify-content value packs boxes at the start? (a) center (b) space-between (c) flex-start (d) flex-end
- 10.True or false: the content is a solid or dotted edge. (a) False (b) True
- 11.True or false: .card is a class selector. (a) False (b) True
- 12.🎯 What kind of selector is body? (a) an element selector (b) a class selector (c) an id selector
-
13.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 200px;
padding: 20px;
border: 1px solid black;
margin: 5px;
} - 14.🌈 In #bc0000 the red part is the hex number bc. What is it as a normal number?
- 15.🎯 Which element does the selector .note style? (a) <h2 class="big"> (b) <li class="red"> (c) <h2 id="note"> (d) <h2 class="note">
-
16.⚖️ What colour is the text of this element?
<p class="red" id="logo">Hi</p>
CSS:
#logo { color: purple; }
.red { color: blue; }
p { color: green; } (a) green (b) white (c) blue (d) purple - 17.🌈 Which colour is #000000? (a) white (b) cyan (c) bright green (d) black
- 18.True or false: padding is space outside the border. (a) False (b) True
- 19.True or false: JavaScript gives the page structure. (a) True (b) False
- 20.🖌️ Which CSS property makes letters bigger? (a) font-size (b) font-weight (c) font-family (d) text-align
- 21.📦 In the box model, which part is space inside the border? (a) margin (b) border (c) padding (d) content
-
22.⚖️ What colour is the text of this element?
<h2 class="big" id="hero">Hi</h2>
CSS:
.big { color: blue; }
.big { color: purple; } (a) blue (b) purple (c) green (d) black - 23.🧩 Which language gives the page structure? (a) JavaScript (b) HTML (c) CSS
-
24.✍️ What value is given to border in this rule?
h1 {
padding: 8px;
border: 2px solid;
} (a) italic (b) 300px (c) 2px solid (d) border - 25.🌈 In #rrggbb, which colour do the first two digits give? (a) green (b) black (c) blue (d) red
-
26.✍️ How many declarations (property: value pairs) are in this rule?
p {
text-align: center;
color: red;
} - 27.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) the first one (c) neither (d) the later one
- 28.✍️ In color: blue; which part is the property? (a) : (b) blue (c) ; (d) color
-
29.🖌️ Where does the text sit on its line?
li {
background-color: red;
text-align: left;
font-size: 40px;
color: yellow;
} (a) on the right (b) in the middle (c) on the left -
30.📱 The screen is 414px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 480px) {
p {
font-size: 28px;
}
} (a) No (b) Yes -
31.📱 The screen is 414px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (max-width: 480px) {
p {
font-size: 18px;
}
} (a) Yes (b) No - 32.📱 min-width: 800px applies when the screen is ___. (a) exactly 100px (b) 800px or wider (c) turned off (d) 800px or narrower
- 33.🌈 Which hex code is bright green? (a) #00ff00 (b) #0000ff (c) #ffffff (d) #000000
- 34.What does font-size do? (a) makes letters bigger (b) sets the letter colour (c) colours behind the text (d) makes the text bold
-
35.✍️ How many declarations (property: value pairs) are in this rule?
li {
font-style: italic;
font-weight: bold;
} - 36.🔍 Which is the odd one out? (a) makes a link (b) checks a quiz answer (c) gives the page structure (d) makes headings and lists
- 37.🎨 Which tag holds CSS inside the head? (a) <css> (b) <body> (c) <script> (d) <style>
- 38.True or false: HTML checks a quiz answer. (a) True (b) False
- 39.Which of these does HTML do? (a) rounds box corners (b) puts a picture on a page (c) adds space around boxes (d) changes the text size
- 40.🌈 Which colour is rgb(0, 0, 255)? (a) blue (b) red (c) white (d) yellow
Answer key
- black
- on the left
- HTML
- puts a picture on a page
- 3
- 266
- No
- No
- flex-start
- False
- True
- an element selector
- 252
- 188
- <h2 class="note">
- purple
- black
- False
- False
- font-size
- padding
- purple
- HTML
- 2px solid
- red
- 2
- the later one
- color
- on the left
- No
- Yes
- 800px or wider
- #00ff00
- makes letters bigger
- 2
- checks a quiz answer
- <style>
- False
- puts a picture on a page
- blue
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids