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.True or false: padding is the gap round content. (a) False (b) True
-
2.⚖️ What colour is the text of this element?
<h2 class="note" id="main">Hi</h2>
CSS:
h2 { color: blue; }
h2 { color: orange; } (a) blue (b) red (c) orange (d) white -
3.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (min-width: 768px) {
p {
font-size: 14px;
}
} - 4.🎯 What kind of selector is p? (a) an element selector (b) an id selector (c) a class selector
-
5.🖌️ What colour is behind the letters?
p {
font-size: 20px;
text-align: right;
background-color: red;
color: purple;
} (a) purple (b) red (c) orange - 6.✍️ In color: blue; which part is the property? (a) blue (b) : (c) color (d) ;
- 7.🧩 Which language puts a picture on a page? (a) HTML (b) CSS (c) JavaScript
- 8.📦 In the box model, which part is the gap round content? (a) margin (b) border (c) padding (d) content
-
9.✍️ What is the selector in this CSS rule?
li {
text-align: center;
border: 2px solid;
font-weight: bold;
} (a) li (b) text-align (c) body (d) 2px solid -
10.✍️ How many declarations (property: value pairs) are in this rule?
li {
text-align: center;
border: 2px solid;
margin: 10px;
font-size: 20px;
} - 11.🎯 What kind of selector is #end? (a) an id selector (b) a class selector (c) an element selector
- 12.True or false: CSS counts down a timer. (a) True (b) False
-
13.✍️ What is the selector in this CSS rule?
.note {
padding: 8px;
border: 2px solid;
color: red;
} (a) padding (b) #top (c) 2px solid (d) .note - 14.True or false: HTML puts a picture on a page. (a) False (b) True
-
15.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 60px;
padding: 15px;
border: 1px solid black;
margin: 0px;
} -
16.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (min-width: 600px) {
p {
font-size: 16px;
}
} (a) Yes (b) No -
17.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 120px;
padding: 5px;
border: 3px solid black;
margin: 0px;
} - 18.⚖️ Which selector is the weakest? (a) an id selector (b) an element selector (c) a class selector
-
19.✍️ How many declarations (property: value pairs) are in this rule?
p {
color: red;
border: 2px solid;
margin: 10px;
} - 20.Which of these does CSS do? (a) checks a quiz answer (b) makes headings and lists (c) reacts to a button click (d) adds space around boxes
- 21.🌈 Which colour is rgb(255, 255, 255)? (a) yellow (b) red (c) cyan (d) white
-
22.📱 The screen is 820px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 768px) {
p {
font-size: 8px;
}
} (a) Yes (b) No - 23.🌈 Which colour of light is strongest in rgb(201, 0, 55)? (a) blue (b) red (c) green
- 24.📦 In the box model, which part is space inside the border? (a) padding (b) content (c) margin (d) border
- 25.📦 In the box model, which part is a solid or dotted edge? (a) margin (b) content (c) padding (d) border
- 26.💪 Which justify-content value equal gaps, none at ends? (a) center (b) space-between (c) flex-start (d) flex-end
- 27.✍️ Which sign goes between a property and its value? (a) - (b) = (c) ; (d) :
-
28.🖌️ What colour are the letters?
h2 {
text-align: right;
background-color: purple;
font-size: 40px;
color: yellow;
} (a) purple (b) yellow (c) red - 29.🌈 Which colour of light is strongest in rgb(234, 29, 41)? (a) red (b) green (c) blue
-
30.🖌️ What colour are the letters?
p {
background-color: green;
color: blue;
font-size: 16px;
text-align: left;
} (a) blue (b) green (c) red - 31.🌈 Which hex code is bright green? (a) #0000ff (b) #ff00ff (c) #ffffff (d) #00ff00
- 32.🎯 Can many elements share the same class? (a) Yes (b) No
-
33.✍️ How many declarations (property: value pairs) are in this rule?
h1 {
width: 300px;
font-style: italic;
} -
34.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 210px;
padding: 5px;
border: 2px solid black;
margin: 10px;
} - 35.🎯 Which sign starts an id selector? (a) & (b) @ (c) . (d) #
- 36.✍️ CSS declarations go inside which brackets? (a) [ ] (b) < > (c) ( ) (d) { }
- 37.Which of these does HTML do? (a) sets colours and fonts (b) makes headings and lists (c) rounds box corners (d) checks a quiz answer
- 38.🎯 Which element does the selector #logo style? (a) <h1 class="big"> (b) <p class="logo"> (c) <p id="end"> (d) <p id="logo">
- 39.True or false: p is an id selector. (a) True (b) False
- 40.🔍 Which is the odd one out? (a) changes the text size (b) lays out the page (c) adds space around boxes (d) puts a picture on a page
Answer key
- True
- orange
- 14
- an element selector
- red
- color
- HTML
- padding
- li
- 4
- an id selector
- False
- .note
- True
- 92
- No
- 136
- an element selector
- 3
- adds space around boxes
- white
- No
- red
- padding
- border
- space-between
- :
- yellow
- red
- blue
- #00ff00
- Yes
- 2
- 224
- #
- { }
- makes headings and lists
- <p id="logo">
- False
- puts a picture on a page
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids