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.✍️ How many declarations (property: value pairs) are in this rule?
h2 {
padding: 8px;
font-size: 20px;
border: 2px solid;
} - 2.🎯 How many elements on a page should have the same id? (a) 2 (b) any number (c) 1 (d) 5
- 3.🎯 What kind of selector is #top? (a) an id selector (b) an element selector (c) a class selector
-
4.🖌️ How big is the text, in px?
h2 {
font-size: 36px;
text-align: right;
background-color: orange;
color: white;
} - 5.🔍 Which is the odd one out? (a) gives the page structure (b) reacts to a button click (c) puts a picture on a page (d) makes headings and lists
-
6.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 140px;
justify-content: flex-end;
}
Inside are 2 boxes, each 50px wide (no margins). - 7.✍️ In color: blue; which part is the value? (a) : (b) ; (c) blue (d) color
- 8.🖌️ Which CSS property makes letters bigger? (a) font-family (b) background-color (c) font-size (d) color
- 9.🎨 What does CSS stand for? (a) Computer Style Sheets (b) Creative Sheet System (c) Colourful Site Styles (d) Cascading Style Sheets
- 10.🧩 Which language reacts to a button click? (a) HTML (b) JavaScript (c) CSS
-
11.📱 The screen is 700px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 480px) {
p {
font-size: 30px;
}
} (a) Yes (b) No -
12.⚖️ What colour is the text of this element?
<h2 class="star" id="intro">Hi</h2>
CSS:
#intro { color: orange; }
#intro { color: purple; } (a) orange (b) purple (c) black (d) yellow - 13.Which of these does JavaScript do? (a) adds space around boxes (b) gives the page structure (c) puts a picture on a page (d) changes the page live
-
14.⚖️ What colour is the text of this element?
<h2 class="box" id="top">Hi</h2>
CSS:
#top { color: black; }
h2 { color: purple; } (a) purple (b) orange (c) white (d) black -
15.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 350px;
justify-content: flex-start;
}
Inside are 3 boxes, each 100px wide (no margins). -
16.✍️ What is the selector in this CSS rule?
#top {
text-align: center;
font-size: 20px;
} (a) 20px (b) text-align (c) li (d) #top -
17.✍️ What is the selector in this CSS rule?
h1 {
text-align: center;
font-style: italic;
} (a) text-align (b) h1 (c) italic (d) p - 18.🧩 Which language makes headings and lists? (a) HTML (b) JavaScript (c) CSS
- 19.🌈 Which colour of light is strongest in rgb(30, 36, 208)? (a) blue (b) green (c) red
- 20.📱 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
- 21.⚖️ Which selector is the weakest? (a) an element selector (b) a class selector (c) an id selector
-
22.⚖️ What colour is the text of this element?
<p class="box" id="logo">Hi</p>
CSS:
p { color: purple; }
p { color: orange; } (a) black (b) orange (c) red (d) purple - 23.✍️ Which sign ends each CSS declaration? (a) . (b) , (c) : (d) ;
-
24.🖌️ What colour is behind the letters?
h1 {
text-align: center;
font-size: 40px;
background-color: red;
color: yellow;
} (a) red (b) black (c) yellow - 25.Which of these is padding? (a) the line round the box (b) space outside the border (c) a solid or dotted edge (d) space inside the border
- 26.📱 What does a media query check? (a) the time of day (b) the battery level (c) the screen width (d) the page title
- 27.🎯 What kind of selector is .big? (a) an element selector (b) an id selector (c) a class selector
- 28.💪 Which justify-content value packs boxes at the end? (a) space-between (b) center (c) flex-end (d) flex-start
- 29.✍️ CSS declarations go inside which brackets? (a) < > (b) ( ) (c) [ ] (d) { }
-
30.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 60px;
padding: 10px;
border: 2px solid black;
margin: 15px;
} - 31.🔍 Which is the odd one out? (a) makes a form box (b) gives the page structure (c) makes a link (d) shows a pop-up message
- 32.🎯 Which sign starts a class selector? (a) @ (b) . (c) & (d) #
-
33.✍️ How many declarations (property: value pairs) are in this rule?
h2 {
background-color: yellow;
font-style: italic;
border: 2px solid;
} -
34.🖌️ Where does the text sit on its line?
li {
background-color: yellow;
text-align: right;
color: green;
font-size: 16px;
} (a) on the right (b) in the middle (c) on the left - 35.What does justify-content: flex-start do? (a) equal gaps, none at ends (b) puts boxes in the middle (c) packs boxes at the end (d) packs boxes at the start
- 36.🔍 Which is the odd one out? (a) makes a link (b) puts a picture on a page (c) makes headings and lists (d) sets colours and fonts
-
37.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (min-width: 1024px) {
p {
font-size: 18px;
}
} - 38.🎯 Which element does the selector #main style? (a) <h1 class="main"> (b) <h2 class="menu"> (c) <h1 id="logo"> (d) <h1 id="main">
- 39.🔍 Which is the odd one out? (a) counts down a timer (b) rounds box corners (c) shows a pop-up message (d) reacts to a button click
- 40.Which of these does HTML do? (a) changes the text size (b) changes the page live (c) makes headings and lists (d) checks a quiz answer
Answer key
- 3
- 1
- an id selector
- 36
- reacts to a button click
- 40
- blue
- font-size
- Cascading Style Sheets
- JavaScript
- Yes
- purple
- changes the page live
- black
- 50
- #top
- h1
- HTML
- blue
- the viewport meta tag
- an element selector
- orange
- ;
- red
- space inside the border
- the screen width
- a class selector
- flex-end
- { }
- 84
- shows a pop-up message
- .
- 3
- on the right
- packs boxes at the start
- sets colours and fonts
- 18
- <h1 id="main">
- rounds box corners
- makes headings and lists
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids