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 flexbox property lines boxes up across? (a) justify-content (b) flex-direction (c) display: flex (d) align-items
- 2.🎨 Which attribute adds CSS inside one tag? (a) style (b) href (c) alt (d) src
- 3.🎨 Which tag holds CSS inside the head? (a) <css> (b) <style> (c) <script> (d) <body>
- 4.📱 Responsive design means a page ___. (a) is only for laptops (b) has no pictures (c) never changes (d) fits every screen
-
5.✍️ How many declarations (property: value pairs) are in this rule?
.note {
border: 2px solid;
margin: 10px;
font-style: italic;
padding: 8px;
} - 6.What does justify-content: space-between do? (a) packs boxes at the start (b) puts boxes in the middle (c) equal gaps, none at ends (d) packs boxes at the end
-
7.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 90px;
padding: 10px;
border: 4px solid black;
margin: 10px;
} - 8.True or false: padding is space outside the border. (a) True (b) False
- 9.💪 Which flexbox property turns on flexbox? (a) align-items (b) display: flex (c) justify-content (d) gap
- 10.🔍 Which is the odd one out? (a) rounds box corners (b) changes the text size (c) sets colours and fonts (d) makes headings and lists
- 11.⚖️ Which selector is the weakest? (a) an element selector (b) an id selector (c) a class selector
- 12.📱 Which tag helps phones show a page at the right size? (a) the br tag (b) the viewport meta tag (c) the title tag (d) the hr tag
-
13.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 220px;
padding: 15px;
border: 2px solid black;
margin: 0px;
} -
14.⚖️ What colour is the text of this element?
<h2 class="menu" id="hero">Hi</h2>
CSS:
h2 { color: green; }
h2 { color: white; } (a) blue (b) white (c) green (d) purple - 15.📱 min-width: 800px applies when the screen is ___. (a) 800px or wider (b) turned off (c) exactly 100px (d) 800px or narrower
-
16.🖌️ Where does the text sit on its line?
h1 {
font-size: 36px;
text-align: center;
color: white;
background-color: red;
} (a) on the right (b) in the middle (c) on the left - 17.🖌️ Which CSS property picks the font style? (a) color (b) font-family (c) text-align (d) font-size
- 18.📦 In the box model, which part is the line round the box? (a) border (b) margin (c) padding (d) content
- 19.True or false: JavaScript reacts to a button click. (a) False (b) True
-
20.✍️ What value is given to text-align in this rule?
p {
font-style: italic;
text-align: center;
} (a) 10px (b) text-align (c) center (d) yellow - 21.What does font-size do? (a) makes the text bold (b) picks the font style (c) makes letters bigger (d) centres a heading
- 22.Which of these does HTML do? (a) checks a quiz answer (b) lays out the page (c) counts down a timer (d) makes a form box
- 23.🎨 One CSS file can style how many pages? (a) only one image (b) many pages (c) no pages (d) only one word
- 24.🔍 Which is the odd one out? (a) reacts to a button click (b) sets colours and fonts (c) changes the page live (d) shows a pop-up message
- 25.🖌️ Which CSS property makes letters bigger? (a) color (b) font-size (c) font-family (d) text-align
-
26.✍️ What is the selector in this CSS rule?
p {
margin: 10px;
font-size: 20px;
color: red;
} (a) p (b) margin (c) 20px (d) .note -
27.🖌️ What colour are the letters?
h1 {
text-align: right;
color: blue;
background-color: yellow;
font-size: 12px;
} (a) yellow (b) green (c) blue - 28.🧩 Which language makes a link? (a) JavaScript (b) HTML (c) CSS
- 29.🔍 Which is the odd one out? (a) puts a picture on a page (b) shows a pop-up message (c) makes headings and lists (d) makes a link
-
30.✍️ Which property is set to 8px in this rule?
.note {
border: 2px solid;
font-size: 20px;
padding: 8px;
} (a) border (b) padding (c) font-weight (d) 8px -
31.✍️ How many declarations (property: value pairs) are in this rule?
h1 {
color: red;
width: 300px;
border: 2px solid;
} - 32.🌈 Which hex code is red? (a) #ffffff (b) #ffff00 (c) #ff0000 (d) #0000ff
- 33.🖌️ Which CSS property centres a heading? (a) background-color (b) font-weight (c) text-align (d) font-size
- 34.🔍 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
- 35.🎯 What kind of selector is .menu? (a) a class selector (b) an element selector (c) an id selector
-
36.📱 The screen is 540px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (max-width: 480px) {
p {
font-size: 14px;
}
} (a) Yes (b) No -
37.⚖️ What colour is the text of this element?
<h1 class="note" id="logo">Hi</h1>
CSS:
#logo { color: yellow; }
h1 { color: green; }
.note { color: red; } (a) white (b) red (c) yellow (d) green - 38.✍️ Which sign ends each CSS declaration? (a) , (b) : (c) . (d) ;
-
39.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 160px;
justify-content: center;
}
Inside are 2 boxes, each 60px wide (no margins). -
40.✍️ How many declarations (property: value pairs) are in this rule?
body {
font-size: 20px;
}
Answer key
- align-items
- style
- <style>
- fits every screen
- 4
- equal gaps, none at ends
- 138
- False
- display: flex
- makes headings and lists
- an element selector
- the viewport meta tag
- 254
- white
- 800px or wider
- in the middle
- font-family
- border
- True
- center
- makes letters bigger
- makes a form box
- many pages
- sets colours and fonts
- font-size
- p
- blue
- HTML
- shows a pop-up message
- padding
- 3
- #ff0000
- text-align
- checks a quiz answer
- a class selector
- No
- yellow
- ;
- 20
- 1
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids