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?
<h1 class="box" id="hero">Hi</h1>
CSS:
#hero { color: green; }
#hero { color: purple; } (a) green (b) blue (c) purple (d) black -
2.🖌️ Where does the text sit on its line?
p {
color: red;
background-color: yellow;
font-size: 28px;
text-align: center;
} (a) on the left (b) on the right (c) in the middle - 3.🧩 Which language sets colours and fonts? (a) HTML (b) CSS (c) JavaScript
- 4.True or false: the content is the text or picture. (a) True (b) False
- 5.🌈 Which colour of light is strongest in rgb(14, 186, 119)? (a) red (b) blue (c) green
-
6.✍️ How many declarations (property: value pairs) are in this rule?
h2 {
color: red;
} -
7.⚖️ What colour is the text of this element?
<h2 class="note" id="main">Hi</h2>
CSS:
.note { color: red; }
#main { color: blue; } (a) red (b) orange (c) purple (d) blue -
8.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 40px;
padding: 20px;
border: 2px solid black;
margin: 0px;
} - 9.Which of these does HTML do? (a) gives the page structure (b) lays out the page (c) adds space around boxes (d) checks a quiz answer
- 10.📦 In the box model, which part is the line round the box? (a) padding (b) margin (c) border (d) content
-
11.📱 The screen is 1100px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (min-width: 768px) {
p {
font-size: 16px;
}
} (a) No (b) Yes - 12.True or false: margin is the gap to other boxes. (a) True (b) False
- 13.🌈 In #rrggbb, which colour do the last two digits give? (a) green (b) red (c) white (d) blue
-
14.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 768px) {
p {
font-size: 18px;
}
} -
15.✍️ How many declarations (property: value pairs) are in this rule?
li {
color: red;
} - 16.✍️ CSS declarations go inside which brackets? (a) < > (b) [ ] (c) { } (d) ( )
- 17.⚖️ Which selector is the weakest? (a) a class selector (b) an element selector (c) an id selector
- 18.💪 Which flexbox property lines boxes up across? (a) display: flex (b) align-items (c) flex-direction (d) gap
- 19.🎯 What kind of selector is #top? (a) an element selector (b) an id selector (c) a class selector
- 20.✍️ In color: blue; which part is the property? (a) blue (b) : (c) ; (d) color
- 21.🖌️ Which CSS property centres a heading? (a) font-size (b) color (c) font-family (d) text-align
-
22.✍️ How many declarations (property: value pairs) are in this rule?
#top {
border: 2px solid;
background-color: yellow;
color: red;
font-size: 20px;
} -
23.🖌️ How big is the text, in px?
h1 {
background-color: red;
text-align: center;
color: green;
font-size: 24px;
} -
24.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 270px;
justify-content: flex-start;
}
Inside are 2 boxes, each 100px wide (no margins). - 25.True or false: #logo is an id selector. (a) True (b) False
-
26.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (max-width: 1024px) {
p {
font-size: 18px;
}
} (a) No (b) Yes - 27.True or false: margin is the gap round content. (a) True (b) False
-
28.✍️ How many declarations (property: value pairs) are in this rule?
li {
border: 2px solid;
background-color: yellow;
} - 29.What does color do? (a) centres a heading (b) colours behind the text (c) sets the letter colour (d) makes letters bigger
-
30.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 60px;
padding: 30px;
border: 1px solid black;
margin: 0px;
} - 31.✍️ In color: blue; which part is the value? (a) color (b) ; (c) blue (d) :
- 32.Which of these is the content? (a) a solid or dotted edge (b) space inside the border (c) space outside the border (d) the text or picture
- 33.🧩 Which language gives the page structure? (a) JavaScript (b) HTML (c) CSS
-
34.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 480px) {
p {
font-size: 8px;
}
} - 35.🎨 One CSS file can style how many pages? (a) no pages (b) only one image (c) many pages (d) only one word
- 36.What does text-align do? (a) colours behind the text (b) centres a heading (c) makes letters bigger (d) makes the text bold
- 37.📱 Which tag helps phones show a page at the right size? (a) the hr tag (b) the viewport meta tag (c) the br tag (d) the title tag
- 38.🌈 In #e80000 the red part is the hex number e8. What is it as a normal number?
-
39.⚖️ What colour is the text of this element?
<h2 class="big" id="intro">Hi</h2>
CSS:
h2 { color: yellow; }
h2 { color: red; } (a) blue (b) red (c) black (d) yellow - 40.🖌️ Which CSS property sets the letter colour? (a) font-weight (b) font-family (c) font-size (d) color
Answer key
- purple
- in the middle
- CSS
- True
- green
- 1
- blue
- 84
- gives the page structure
- border
- Yes
- True
- blue
- 20
- 1
- { }
- an element selector
- align-items
- an id selector
- color
- text-align
- 4
- 24
- 70
- True
- Yes
- False
- 2
- sets the letter colour
- 122
- blue
- the text or picture
- HTML
- 8
- many pages
- centres a heading
- the viewport meta tag
- 232
- red
- color
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids