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 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 600px) {
p {
font-size: 24px;
}
} - 2.🌈 Which colour is #000000? (a) red (b) blue (c) black (d) white
-
3.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (min-width: 768px) {
p {
font-size: 16px;
}
} -
4.🎯 Which CSS selector matches this element?
<p class="menu" id="hero">Hello</p> (a) .note (b) #top (c) #menu (d) p - 5.🎨 Which tag holds CSS inside the head? (a) <style> (b) <script> (c) <body> (d) <css>
- 6.What does color do? (a) colours behind the text (b) sets the letter colour (c) picks the font style (d) makes letters bigger
-
7.🖌️ What colour is behind the letters?
li {
color: purple;
text-align: left;
font-size: 12px;
background-color: red;
} (a) purple (b) blue (c) red - 8.🎯 What kind of selector is img? (a) an id selector (b) an element selector (c) a class selector
-
9.✍️ What value is given to color in this rule?
h2 {
color: red;
border: 2px solid;
width: 300px;
text-align: center;
} (a) center (b) color (c) red (d) 20px - 10.🌈 Which colour is #ffff00? (a) black (b) bright green (c) red (d) yellow
-
11.🎯 Which CSS selector matches this element?
<li class="red" id="intro">Hello</li> (a) li (b) #red (c) #main (d) .box - 12.💪 Which justify-content value equal gaps, none at ends? (a) center (b) space-between (c) flex-end (d) flex-start
- 13.🧩 Which language shows a pop-up message? (a) CSS (b) HTML (c) JavaScript
- 14.📱 Responsive design means a page ___. (a) fits every screen (b) has no pictures (c) is only for laptops (d) never changes
-
15.✍️ What value is given to font-weight in this rule?
.note {
width: 300px;
font-weight: bold;
} (a) font-weight (b) bold (c) 2px solid (d) 300px -
16.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 600px) {
p {
font-size: 10px;
}
} (a) No (b) Yes -
17.🎯 Which CSS selector matches this element?
<h2 class="menu" id="logo">Hello</h2> (a) #menu (b) .logo (c) h2 (d) .note - 18.Which of these does JavaScript do? (a) reacts to a button click (b) puts a picture on a page (c) makes headings and lists (d) gives the page structure
- 19.🎨 What does CSS stand for? (a) Colourful Site Styles (b) Cascading Style Sheets (c) Creative Sheet System (d) Computer Style Sheets
- 20.True or false: CSS adds space around boxes. (a) True (b) False
- 21.🌈 In #0000bb the blue part is the hex number bb. What is it as a normal number?
-
22.⚖️ What colour is the text of this element?
<h2 class="note" id="hero">Hi</h2>
CSS:
.note { color: orange; }
h2 { color: yellow; } (a) green (b) orange (c) red (d) yellow - 23.What does font-weight do? (a) colours behind the text (b) makes the text bold (c) picks the font style (d) sets the letter colour
-
24.🎯 Which CSS selector matches this element?
<div class="red" id="main">Hello</div> (a) .box (b) div (c) #red (d) .main -
25.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 180px;
justify-content: flex-start;
}
Inside are 4 boxes, each 40px wide (no margins). - 26.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) turned off (c) 800px or wider (d) exactly 100px
- 27.🎨 Which attribute adds CSS inside one tag? (a) src (b) href (c) alt (d) style
-
28.✍️ What value is given to margin in this rule?
.note {
font-weight: bold;
border: 2px solid;
padding: 8px;
margin: 10px;
} (a) margin (b) 8px (c) 10px (d) bold - 29.True or false: HTML sets colours and fonts. (a) True (b) False
- 30.🎯 Which sign starts an id selector? (a) # (b) & (c) @ (d) .
- 31.💪 Which justify-content value puts boxes in the middle? (a) flex-end (b) center (c) flex-start (d) space-between
- 32.True or false: padding is the text or picture. (a) False (b) True
- 33.🧩 Which language makes a link? (a) JavaScript (b) CSS (c) HTML
- 34.🌈 Which colour is #00ff00? (a) yellow (b) bright green (c) white (d) red
-
35.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 140px;
padding: 20px;
border: 1px solid black;
margin: 5px;
} - 36.🌈 Which colour of light is strongest in rgb(69, 82, 156)? (a) red (b) blue (c) green
- 37.Which of these does CSS do? (a) counts down a timer (b) changes the page live (c) reacts to a button click (d) lays out the page
- 38.🖌️ Which CSS property picks the font style? (a) text-align (b) font-size (c) font-family (d) background-color
- 39.🌈 Which colour of light is strongest in rgb(139, 158, 112)? (a) red (b) green (c) blue
-
40.✍️ What is the selector in this CSS rule?
li {
font-style: italic;
font-weight: bold;
border: 2px solid;
} (a) li (b) body (c) bold (d) font-style
Answer key
- 16
- black
- 12
- p
- <style>
- sets the letter colour
- red
- an element selector
- red
- yellow
- li
- space-between
- JavaScript
- fits every screen
- bold
- Yes
- h2
- reacts to a button click
- Cascading Style Sheets
- True
- 187
- orange
- makes the text bold
- div
- 20
- 800px or wider
- style
- 10px
- False
- #
- center
- False
- HTML
- bright green
- 192
- blue
- lays out the page
- font-family
- green
- li
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids