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.✍️ In color: blue; which part is the value? (a) : (b) blue (c) color (d) ;
-
2.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 120px;
padding: 10px;
border: 3px solid black;
margin: 20px;
} - 3.✍️ How does a CSS comment start? (a) /* (b) # (c) // (d) <!--
-
4.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 340px;
justify-content: center;
}
Inside are 4 boxes, each 80px wide (no margins). - 5.🎨 Which tag connects an outside CSS file? (a) <link> (b) <a> (c) <css> (d) <img>
- 6.💪 Which flexbox property turns on flexbox? (a) flex-direction (b) display: flex (c) justify-content (d) gap
- 7.🔍 Which is the odd one out? (a) puts a picture on a page (b) makes a link (c) shows a pop-up message (d) makes a form box
- 8.🎯 Which sign starts a class selector? (a) & (b) . (c) @ (d) #
-
9.⚖️ What colour is the text of this element?
<h1 class="big" id="hero">Hi</h1>
CSS:
h1 { color: white; }
h1 { color: yellow; } (a) red (b) white (c) yellow (d) orange - 10.True or false: .star is a class selector. (a) True (b) False
- 11.🌈 Which colour is rgb(0, 255, 255)? (a) white (b) red (c) cyan (d) bright green
- 12.⚖️ Which selector is the strongest? (a) a class selector (b) an id selector (c) an element selector
- 13.Which of these does JavaScript do? (a) gives the page structure (b) makes headings and lists (c) makes a link (d) checks a quiz answer
- 14.Which of these does CSS do? (a) checks a quiz answer (b) makes a link (c) sets colours and fonts (d) gives the page structure
-
15.🎯 Which CSS selector matches this element?
<span class="box" id="intro">Hello</span> (a) #intro (b) p (c) #main (d) .intro - 16.📱 Which tag helps phones show a page at the right size? (a) the viewport meta tag (b) the br tag (c) the title tag (d) the hr tag
- 17.🎨 What does CSS stand for? (a) Computer Style Sheets (b) Colourful Site Styles (c) Cascading Style Sheets (d) Creative Sheet System
- 18.🌈 Which colour is #00ff00? (a) blue (b) bright green (c) white (d) magenta
- 19.What does background-color do? (a) makes letters bigger (b) colours behind the text (c) picks the font style (d) sets the letter colour
-
20.⚖️ What colour is the text of this element?
<h2 class="big" id="top">Hi</h2>
CSS:
.big { color: orange; }
.big { color: purple; } (a) green (b) orange (c) yellow (d) purple - 21.True or false: p is an element selector. (a) True (b) False
- 22.🖌️ Which CSS property makes letters bigger? (a) background-color (b) text-align (c) font-weight (d) font-size
-
23.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 1024px) {
p {
font-size: 28px;
}
} - 24.✍️ CSS declarations go inside which brackets? (a) [ ] (b) < > (c) { } (d) ( )
- 25.📦 In the box model, which part is space outside the border? (a) margin (b) content (c) border (d) padding
- 26.🎯 Which element does the selector #hero style? (a) <li id="top"> (b) <div class="red"> (c) <li class="hero"> (d) <li id="hero">
- 27.🧩 Which language puts a picture on a page? (a) HTML (b) JavaScript (c) CSS
-
28.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 250px;
padding: 10px;
border: 4px solid black;
margin: 0px;
} - 29.What does justify-content: flex-start 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
-
30.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (min-width: 1024px) {
p {
font-size: 22px;
}
} -
31.✍️ What value is given to color in this rule?
.note {
width: 300px;
text-align: center;
color: red;
} (a) red (b) color (c) center (d) 20px - 32.🌈 Which colour of light is strongest in rgb(106, 178, 84)? (a) blue (b) green (c) red
-
33.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (min-width: 600px) {
p {
font-size: 14px;
}
} - 34.💪 Which justify-content value equal gaps, none at ends? (a) space-between (b) center (c) flex-end (d) flex-start
-
35.✍️ What value is given to font-weight in this rule?
.note {
font-weight: bold;
color: red;
} (a) bold (b) 2px solid (c) font-weight (d) 300px - 36.Which of these does HTML do? (a) makes headings and lists (b) changes the text size (c) adds space around boxes (d) counts down a timer
- 37.True or false: h1 is an element selector. (a) True (b) False
- 38.True or false: .card is an id selector. (a) False (b) True
-
39.✍️ How many declarations (property: value pairs) are in this rule?
p {
color: red;
} -
40.⚖️ What colour is the text of this element?
<h1 class="note" id="logo">Hi</h1>
CSS:
.note { color: white; }
#logo { color: green; }
h1 { color: orange; } (a) black (b) white (c) green (d) orange
Answer key
- blue
- 186
- /*
- 10
- <link>
- display: flex
- shows a pop-up message
- .
- yellow
- True
- cyan
- an id selector
- checks a quiz answer
- sets colours and fonts
- #intro
- the viewport meta tag
- Cascading Style Sheets
- bright green
- colours behind the text
- purple
- True
- font-size
- 24
- { }
- margin
- <li id="hero">
- HTML
- 278
- packs boxes at the start
- 20
- red
- green
- 12
- space-between
- bold
- makes headings and lists
- True
- False
- 1
- green
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids