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) puts a picture on a page (b) adds space around boxes (c) makes a form box (d) makes headings and lists
- 2.🖌️ Which CSS property picks the font style? (a) background-color (b) font-weight (c) text-align (d) font-family
- 3.🎯 Which element does the selector #top style? (a) <li id="intro"> (b) <li id="top"> (c) <li class="top"> (d) <div class="big">
- 4.✍️ CSS declarations go inside which brackets? (a) ( ) (b) < > (c) [ ] (d) { }
-
5.🎯 Which CSS selector matches this element?
<span class="big" id="main">Hello</span> (a) span (b) .main (c) #big (d) .red - 6.🧩 Which language lays out the page? (a) JavaScript (b) CSS (c) HTML
- 7.What does justify-content: center do? (a) packs boxes at the end (b) packs boxes at the start (c) puts boxes in the middle (d) equal gaps, none at ends
- 8.🎯 What kind of selector is h1? (a) an id selector (b) a class selector (c) an element selector
-
9.⚖️ What colour is the text of this element?
<p class="menu" id="top">Hi</p>
CSS:
#top { color: purple; }
p { color: blue; } (a) purple (b) yellow (c) green (d) blue - 10.🧩 Which language makes a link? (a) HTML (b) CSS (c) JavaScript
- 11.✍️ How does a CSS comment start? (a) # (b) // (c) /* (d) <!--
-
12.✍️ How many declarations (property: value pairs) are in this rule?
.note {
color: red;
text-align: center;
font-size: 20px;
margin: 10px;
} - 13.🔍 Which is the odd one out? (a) puts a picture on a page (b) makes a link (c) sets colours and fonts (d) makes a form box
- 14.✍️ Which sign ends each CSS declaration? (a) ; (b) . (c) : (d) ,
- 15.🌈 Hex digits go 0 to 9, then A to which letter? (a) Z (b) F (c) J (d) G
-
16.🖌️ Where does the text sit on its line?
h2 {
text-align: center;
background-color: red;
font-size: 20px;
color: white;
} (a) in the middle (b) on the left (c) on the right -
17.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 70px;
padding: 30px;
border: 3px solid black;
margin: 20px;
} - 18.What does color do? (a) colours behind the text (b) makes the text bold (c) sets the letter colour (d) centres a heading
-
19.🖌️ What colour are the letters?
h1 {
font-size: 28px;
background-color: blue;
color: white;
text-align: center;
} (a) blue (b) green (c) white -
20.✍️ What is the selector in this CSS rule?
h1 {
color: red;
padding: 8px;
text-align: center;
} (a) p (b) color (c) 8px (d) h1 - 21.⚖️ Which selector is the strongest? (a) a class selector (b) an element selector (c) an id selector
- 22.🖌️ Which CSS property sets the letter colour? (a) font-family (b) background-color (c) font-size (d) color
- 23.📦 In the box model, which part is a solid or dotted edge? (a) border (b) padding (c) content (d) margin
- 24.Which of these does HTML do? (a) sets colours and fonts (b) counts down a timer (c) makes a link (d) shows a pop-up message
- 25.💪 Which justify-content value packs boxes at the start? (a) flex-end (b) center (c) space-between (d) flex-start
-
26.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 60px;
padding: 25px;
border: 1px solid black;
margin: 5px;
} - 27.🔍 Which is the odd one out? (a) makes a link (b) checks a quiz answer (c) makes headings and lists (d) makes a form box
-
28.🎯 Which CSS selector matches this element?
<h2 class="box" id="end">Hello</h2> (a) #box (b) .box (c) #hero (d) .end - 29.🌈 Which colour is rgb(0, 255, 0)? (a) yellow (b) black (c) red (d) bright green
- 30.🌈 In #8d0000 the red part is the hex number 8d. What is it as a normal number?
- 31.What does font-weight do? (a) picks the font style (b) makes the text bold (c) makes letters bigger (d) centres a heading
- 32.True or false: CSS makes headings and lists. (a) False (b) True
-
33.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 40px;
padding: 5px;
border: 2px solid black;
margin: 20px;
} - 34.✍️ In color: blue; which part is the property? (a) blue (b) : (c) ; (d) color
-
35.✍️ Which property is set to 2px solid in this rule?
h2 {
margin: 10px;
font-style: italic;
padding: 8px;
border: 2px solid;
} (a) 2px solid (b) width (c) font-style (d) border - 36.🔍 Which is the odd one out? (a) makes headings and lists (b) gives the page structure (c) puts a picture on a page (d) changes the text size
-
37.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 290px;
padding: 30px;
border: 5px solid black;
margin: 20px;
} - 38.🧩 Which language changes the text size? (a) JavaScript (b) HTML (c) CSS
- 39.🖌️ Which CSS property colours behind the text? (a) background-color (b) color (c) text-align (d) font-weight
-
40.🖌️ How big is the text, in px?
h2 {
font-size: 12px;
color: purple;
text-align: right;
background-color: black;
}
Answer key
- adds space around boxes
- font-family
- <li id="top">
- { }
- span
- CSS
- puts boxes in the middle
- an element selector
- purple
- HTML
- /*
- 4
- sets colours and fonts
- ;
- F
- in the middle
- 176
- sets the letter colour
- white
- h1
- an id selector
- color
- border
- makes a link
- flex-start
- 122
- checks a quiz answer
- .box
- bright green
- 141
- makes the text bold
- False
- 94
- color
- border
- changes the text size
- 400
- CSS
- background-color
- 12
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids