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) rounds box corners (b) changes the text size (c) makes headings and lists (d) lays out the page
- 2.⚖️ Which selector is the weakest? (a) a class selector (b) an id selector (c) an element selector
- 3.✍️ In color: blue; which part is the value? (a) blue (b) ; (c) : (d) color
- 4.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the later one (b) the first one (c) neither (d) the shorter one
- 5.🌈 What is the biggest number one colour can have in rgb()? (a) 1000 (b) 99 (c) 100 (d) 255
- 6.🌈 Which colour of light is strongest in rgb(1, 165, 6)? (a) green (b) red (c) blue
-
7.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 1024px) {
p {
font-size: 18px;
}
} - 8.Which of these does JavaScript do? (a) counts down a timer (b) lays out the page (c) gives the page structure (d) makes a form box
- 9.🔍 Which is the odd one out? (a) shows a pop-up message (b) changes the page live (c) reacts to a button click (d) makes a form box
- 10.⚖️ Which selector is the strongest? (a) a class selector (b) an id selector (c) an element selector
-
11.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 140px;
justify-content: space-between;
}
Inside are 2 boxes, each 60px wide (no margins). -
12.🎯 Which CSS selector matches this element?
<li class="star" id="top">Hello</li> (a) #star (b) .top (c) .menu (d) .star - 13.True or false: the content is the text or picture. (a) True (b) False
- 14.🎨 One CSS file can style how many pages? (a) only one image (b) no pages (c) only one word (d) many pages
- 15.🎨 A CSS file usually ends with which extension? (a) .png (b) .css (c) .js (d) .html
- 16.True or false: JavaScript gives the page structure. (a) True (b) False
-
17.✍️ What value is given to background-color in this rule?
.note {
font-size: 20px;
background-color: yellow;
color: red;
} (a) 10px (b) background-color (c) 8px (d) yellow - 18.✍️ How does a CSS comment start? (a) # (b) /* (c) <!-- (d) //
-
19.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 130px;
justify-content: flex-end;
}
Inside are 2 boxes, each 50px wide (no margins). - 20.🎯 Can many elements share the same class? (a) Yes (b) No
- 21.🖌️ Which CSS property sets the letter colour? (a) font-size (b) text-align (c) background-color (d) color
- 22.🎯 What kind of selector is .card? (a) a class selector (b) an element selector (c) an id selector
-
23.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 120px;
justify-content: flex-start;
}
Inside are 2 boxes, each 50px wide (no margins). - 24.💪 Which justify-content value packs boxes at the end? (a) flex-start (b) space-between (c) flex-end (d) center
-
25.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 300px;
justify-content: center;
}
Inside are 4 boxes, each 50px wide (no margins). - 26.📱 Which tag helps phones show a page at the right size? (a) the viewport meta tag (b) the hr tag (c) the br tag (d) the title tag
-
27.✍️ How many declarations (property: value pairs) are in this rule?
p {
border: 2px solid;
width: 300px;
} - 28.🌈 Which colour is #00ffff? (a) bright green (b) black (c) cyan (d) red
- 29.True or false: the border is space inside the border. (a) False (b) True
- 30.🖌️ Which CSS property colours behind the text? (a) background-color (b) font-weight (c) text-align (d) font-family
-
31.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (min-width: 1024px) {
p {
font-size: 22px;
}
} -
32.⚖️ What colour is the text of this element?
<h2 class="box" id="top">Hi</h2>
CSS:
#top { color: white; }
#top { color: red; } (a) white (b) red (c) yellow (d) blue - 33.📦 In the box model, which part is space inside the border? (a) content (b) margin (c) padding (d) border
- 34.🌈 In #rrggbb, which colour do the first two digits give? (a) red (b) black (c) green (d) blue
-
35.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 400px;
justify-content: center;
}
Inside are 3 boxes, each 80px wide (no margins). -
36.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 230px;
justify-content: flex-end;
}
Inside are 3 boxes, each 50px wide (no margins). - 37.True or false: #logo is an id selector. (a) False (b) True
- 38.💪 Which justify-content value packs boxes at the start? (a) space-between (b) flex-end (c) center (d) flex-start
-
39.⚖️ What colour is the text of this element?
<h2 class="big" id="main">Hi</h2>
CSS:
h2 { color: orange; }
h2 { color: green; } (a) black (b) red (c) orange (d) green - 40.Which of these does HTML do? (a) makes a link (b) adds space around boxes (c) changes the page live (d) reacts to a button click
Answer key
- makes headings and lists
- an element selector
- blue
- the later one
- 255
- green
- 18
- counts down a timer
- makes a form box
- an id selector
- 20
- .star
- True
- many pages
- .css
- False
- yellow
- /*
- 30
- Yes
- color
- a class selector
- 20
- flex-end
- 50
- the viewport meta tag
- 2
- cyan
- False
- background-color
- 20
- red
- padding
- red
- 80
- 80
- True
- flex-start
- green
- makes a link
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids