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 colour is #ffff00? (a) white (b) bright green (c) yellow (d) black
-
2.✍️ What value is given to text-align in this rule?
h1 {
font-size: 20px;
text-align: center;
} (a) text-align (b) center (c) 10px (d) yellow -
3.✍️ How many declarations (property: value pairs) are in this rule?
p {
padding: 8px;
text-align: center;
} -
4.📱 The screen is 414px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (min-width: 768px) {
p {
font-size: 22px;
}
} (a) Yes (b) No - 5.🖌️ Which CSS property picks the font style? (a) font-family (b) text-align (c) font-size (d) font-weight
-
6.✍️ Which property is set to 300px in this rule?
li {
padding: 8px;
text-align: center;
width: 300px;
font-size: 20px;
} (a) width (b) font-style (c) color (d) 300px -
7.⚖️ What colour is the text of this element?
<h1 class="star" id="logo">Hi</h1>
CSS:
h1 { color: green; }
.star { color: blue; } (a) green (b) purple (c) black (d) blue - 8.⚖️ Which selector is the strongest? (a) a class selector (b) an element selector (c) an id selector
- 9.🖌️ Which CSS property makes the text bold? (a) color (b) font-family (c) text-align (d) font-weight
-
10.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 200px;
justify-content: space-between;
}
Inside are 2 boxes, each 80px wide (no margins). - 11.Which of these does CSS do? (a) shows a pop-up message (b) reacts to a button click (c) sets colours and fonts (d) checks a quiz answer
-
12.✍️ What value is given to font-size in this rule?
li {
font-size: 20px;
font-style: italic;
margin: 10px;
width: 300px;
} (a) font-size (b) center (c) yellow (d) 20px -
13.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 180px;
justify-content: center;
}
Inside are 2 boxes, each 60px wide (no margins). - 14.True or false: #hero is a class selector. (a) True (b) False
- 15.📦 In the box model, which part is space inside the border? (a) margin (b) content (c) padding (d) border
- 16.🌈 Which colour of light is strongest in rgb(77, 70, 170)? (a) blue (b) green (c) red
-
17.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 150px;
justify-content: flex-start;
}
Inside are 2 boxes, each 60px wide (no margins). - 18.💪 Which justify-content value puts boxes in the middle? (a) space-between (b) flex-start (c) center (d) flex-end
- 19.🧩 Which language reacts to a button click? (a) CSS (b) JavaScript (c) HTML
- 20.🌈 Which colour is #0000ff? (a) yellow (b) white (c) blue (d) cyan
- 21.🖌️ Which CSS property sets the letter colour? (a) font-size (b) background-color (c) color (d) font-family
-
22.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (min-width: 768px) {
p {
font-size: 26px;
}
} (a) Yes (b) No -
23.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 220px;
justify-content: center;
}
Inside are 2 boxes, each 40px wide (no margins). - 24.True or false: HTML puts a picture on a page. (a) False (b) True
-
25.🖌️ What colour is behind the letters?
li {
background-color: purple;
color: white;
font-size: 28px;
text-align: left;
} (a) purple (b) blue (c) white - 26.🌈 Which colour is rgb(0, 255, 255)? (a) cyan (b) white (c) bright green (d) blue
- 27.🌈 Which colour is rgb(0, 0, 0)? (a) yellow (b) red (c) blue (d) black
-
28.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 110px;
padding: 5px;
border: 2px solid black;
margin: 0px;
} -
29.📱 The screen is 820px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (max-width: 480px) {
p {
font-size: 22px;
}
} (a) Yes (b) No - 30.What does background-color do? (a) picks the font style (b) makes letters bigger (c) makes the text bold (d) colours behind the text
- 31.✍️ How does a CSS comment start? (a) // (b) /* (c) # (d) <!--
- 32.🌈 Hex digits go 0 to 9, then A to which letter? (a) F (b) G (c) J (d) Z
- 33.Which of these does JavaScript do? (a) makes a form box (b) reacts to a button click (c) rounds box corners (d) adds space around boxes
-
34.⚖️ What colour is the text of this element?
<p class="menu" id="top">Hi</p>
CSS:
.menu { color: blue; }
.menu { color: red; } (a) white (b) blue (c) yellow (d) red - 35.🧩 Which language makes a link? (a) JavaScript (b) CSS (c) HTML
-
36.🖌️ Where does the text sit on its line?
h2 {
background-color: green;
color: yellow;
font-size: 36px;
text-align: center;
} (a) in the middle (b) on the left (c) on the right - 37.📦 In the box model, which part is the gap round content? (a) content (b) padding (c) margin (d) border
- 38.🎯 What kind of selector is h1? (a) a class selector (b) an id selector (c) an element selector
- 39.🧩 Which language makes headings and lists? (a) CSS (b) HTML (c) JavaScript
- 40.What does font-family do? (a) centres a heading (b) makes the text bold (c) colours behind the text (d) picks the font style
Answer key
- yellow
- center
- 2
- No
- font-family
- width
- blue
- an id selector
- font-weight
- 40
- sets colours and fonts
- 20px
- 30
- False
- padding
- blue
- 30
- center
- JavaScript
- blue
- color
- No
- 70
- True
- purple
- cyan
- black
- 124
- No
- colours behind the text
- /*
- F
- reacts to a button click
- red
- HTML
- in the middle
- padding
- an element selector
- HTML
- picks the font style
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids