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.📱 The screen is 1366px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (min-width: 600px) {
p {
font-size: 28px;
}
} (a) No (b) Yes - 2.🧩 Which language makes headings and lists? (a) JavaScript (b) CSS (c) HTML
- 3.True or false: CSS lays out the page. (a) True (b) False
-
4.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (max-width: 480px) {
p {
font-size: 16px;
}
} (a) Yes (b) No - 5.🌈 In #110000 the red part is the hex number 11. What is it as a normal number?
- 6.✍️ In color: blue; which part is the value? (a) ; (b) color (c) : (d) blue
- 7.🌈 Which colour is rgb(0, 255, 255)? (a) red (b) yellow (c) cyan (d) bright green
-
8.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 1024px) {
p {
font-size: 14px;
}
} -
9.✍️ What is the selector in this CSS rule?
.note {
font-style: italic;
text-align: center;
color: red;
} (a) center (b) #top (c) font-style (d) .note - 10.🧩 Which language makes a link? (a) HTML (b) JavaScript (c) CSS
-
11.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 130px;
justify-content: space-between;
}
Inside are 2 boxes, each 40px wide (no margins). - 12.Which of these is padding? (a) space outside the border (b) a solid or dotted edge (c) the text or picture (d) the gap round content
- 13.What does color do? (a) picks the font style (b) centres a heading (c) makes the text bold (d) sets the letter colour
-
14.⚖️ What colour is the text of this element?
<p class="red" id="hero">Hi</p>
CSS:
.red { color: purple; }
.red { color: yellow; } (a) red (b) purple (c) yellow (d) white - 15.🌈 In #0000f6 the blue part is the hex number f6. What is it as a normal number?
-
16.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 170px;
padding: 15px;
border: 2px solid black;
margin: 5px;
} -
17.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 480px) {
p {
font-size: 10px;
}
} -
18.✍️ How many declarations (property: value pairs) are in this rule?
li {
color: red;
} - 19.✍️ How does a CSS comment start? (a) <!-- (b) # (c) // (d) /*
- 20.True or false: li is an element selector. (a) True (b) False
- 21.🌈 In #5d0000 the red part is the hex number 5d. What is it as a normal number?
- 22.🖌️ Which CSS property sets the letter colour? (a) font-size (b) text-align (c) font-family (d) color
- 23.⚖️ Which selector is the strongest? (a) a class selector (b) an id selector (c) an element selector
- 24.True or false: body is an element selector. (a) False (b) True
-
25.⚖️ What colour is the text of this element?
<p class="box" id="main">Hi</p>
CSS:
p { color: white; }
.box { color: orange; } (a) purple (b) red (c) white (d) orange -
26.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 480px) {
p {
font-size: 6px;
}
} (a) Yes (b) No -
27.✍️ How many declarations (property: value pairs) are in this rule?
.note {
font-style: italic;
margin: 10px;
padding: 8px;
} - 28.🌈 In #cb0000 the red part is the hex number cb. What is it as a normal number?
-
29.🎯 Which CSS selector matches this element?
<li class="star" id="logo">Hello</li> (a) li (b) div (c) #star (d) .logo -
30.🎯 Which CSS selector matches this element?
<h2 class="box" id="logo">Hello</h2> (a) h2 (b) #box (c) .star (d) .logo -
31.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (max-width: 480px) {
p {
font-size: 22px;
}
} (a) Yes (b) No - 32.✍️ CSS declarations go inside which brackets? (a) ( ) (b) < > (c) [ ] (d) { }
- 33.What does font-family do? (a) picks the font style (b) colours behind the text (c) sets the letter colour (d) makes letters bigger
- 34.🔍 Which is the odd one out? (a) lays out the page (b) makes a link (c) changes the text size (d) rounds box corners
-
35.✍️ What value is given to text-align in this rule?
h2 {
border: 2px solid;
text-align: center;
font-size: 20px;
} (a) text-align (b) center (c) yellow (d) 10px - 36.🔍 Which is the odd one out? (a) sets colours and fonts (b) rounds box corners (c) gives the page structure (d) lays out the page
- 37.True or false: #end is an id selector. (a) False (b) True
- 38.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the first one (c) the later one (d) the shorter one
- 39.🎯 How many elements on a page should have the same id? (a) 5 (b) any number (c) 1 (d) 2
- 40.✍️ In color: blue; which part is the property? (a) color (b) ; (c) : (d) blue
Answer key
- Yes
- HTML
- True
- Yes
- 17
- blue
- cyan
- 14
- .note
- HTML
- 50
- the gap round content
- sets the letter colour
- yellow
- 246
- 214
- 12
- 1
- /*
- True
- 93
- color
- an id selector
- True
- orange
- Yes
- 3
- 203
- li
- h2
- Yes
- { }
- picks the font style
- makes a link
- center
- gives the page structure
- True
- the later one
- 1
- color
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids