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.⚖️ What colour is the text of this element?
<p class="box" id="top">Hi</p>
CSS:
#top { color: red; }
#top { color: black; } (a) orange (b) black (c) red (d) green -
2.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (max-width: 480px) {
p {
font-size: 20px;
}
} (a) No (b) Yes -
3.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 768px) {
p {
font-size: 8px;
}
} - 4.🎨 What does CSS stand for? (a) Computer Style Sheets (b) Cascading Style Sheets (c) Colourful Site Styles (d) Creative Sheet System
-
5.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 480px) {
p {
font-size: 14px;
}
} - 6.🎯 Which element does the selector #logo style? (a) <p id="logo"> (b) <h1 class="box"> (c) <p id="end"> (d) <p class="logo">
- 7.🎯 Which sign starts an id selector? (a) # (b) . (c) & (d) @
- 8.🌈 Which colour of light is strongest in rgb(128, 134, 154)? (a) blue (b) red (c) green
- 9.True or false: HTML makes headings and lists. (a) True (b) False
- 10.🎯 What kind of selector is .star? (a) an element selector (b) a class selector (c) an id selector
- 11.Which of these does HTML do? (a) rounds box corners (b) makes a link (c) shows a pop-up message (d) adds space around boxes
-
12.⚖️ What colour is the text of this element?
<h2 class="note" id="end">Hi</h2>
CSS:
h2 { color: orange; }
h2 { color: green; } (a) red (b) green (c) white (d) orange - 13.✍️ Which sign ends each CSS declaration? (a) , (b) ; (c) : (d) .
- 14.Which of these does CSS do? (a) makes headings and lists (b) changes the text size (c) shows a pop-up message (d) reacts to a button click
- 15.🎯 How many elements on a page should have the same id? (a) 2 (b) any number (c) 5 (d) 1
- 16.📱 max-width: 600px applies when the screen is ___. (a) 600px or narrower (b) 600px or wider (c) turned off (d) exactly 1000px
- 17.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the first one (b) the later one (c) the shorter one (d) neither
-
18.⚖️ What colour is the text of this element?
<h2 class="big" id="hero">Hi</h2>
CSS:
.big { color: blue; }
h2 { color: green; } (a) green (b) white (c) blue (d) purple - 19.True or false: padding is space inside the border. (a) True (b) False
- 20.True or false: the content is space outside the border. (a) False (b) True
- 21.🎯 What kind of selector is h1? (a) an id selector (b) an element selector (c) a class selector
- 22.🖌️ Which CSS property sets the letter colour? (a) background-color (b) font-size (c) font-weight (d) color
- 23.✍️ Which sign goes between a property and its value? (a) - (b) ; (c) = (d) :
- 24.True or false: h1 is a class selector. (a) False (b) True
- 25.✍️ In color: blue; which part is the value? (a) blue (b) ; (c) : (d) color
-
26.⚖️ What colour is the text of this element?
<h1 class="big" id="hero">Hi</h1>
CSS:
#hero { color: red; }
#hero { color: white; } (a) orange (b) red (c) white (d) green -
27.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 180px;
padding: 30px;
border: 5px solid black;
margin: 10px;
} -
28.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 600px) {
p {
font-size: 10px;
}
} - 29.📱 Which tag helps phones show a page at the right size? (a) the title tag (b) the br tag (c) the hr tag (d) the viewport meta tag
- 30.🌈 Which colour is #000000? (a) bright green (b) black (c) red (d) magenta
-
31.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 140px;
justify-content: flex-start;
}
Inside are 2 boxes, each 50px wide (no margins). - 32.🧩 Which language makes headings and lists? (a) CSS (b) HTML (c) JavaScript
-
33.✍️ Which property is set to red in this rule?
h1 {
color: red;
background-color: yellow;
text-align: center;
font-size: 20px;
} (a) font-size (b) text-align (c) red (d) color -
34.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 90px;
padding: 10px;
border: 5px solid black;
margin: 20px;
} -
35.📱 The screen is 700px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (max-width: 600px) {
p {
font-size: 18px;
}
} (a) No (b) Yes -
36.✍️ What value is given to text-align in this rule?
#top {
text-align: center;
background-color: yellow;
font-size: 20px;
} (a) yellow (b) 10px (c) text-align (d) center - 37.🎯 What kind of selector is #logo? (a) a class selector (b) an id selector (c) an element selector
- 38.What does color do? (a) makes the text bold (b) makes letters bigger (c) centres a heading (d) sets the letter colour
- 39.💪 Which flexbox property lines boxes up across? (a) flex-direction (b) display: flex (c) justify-content (d) align-items
-
40.🎯 Which CSS selector matches this element?
<p class="box" id="end">Hello</p> (a) #end (b) #hero (c) h1 (d) #box
Answer key
- black
- Yes
- 8
- Cascading Style Sheets
- 14
- <p id="logo">
- #
- blue
- True
- a class selector
- makes a link
- green
- ;
- changes the text size
- 1
- 600px or narrower
- the later one
- blue
- True
- False
- an element selector
- color
- :
- False
- blue
- white
- 270
- 10
- the viewport meta tag
- black
- 40
- HTML
- color
- 160
- No
- center
- an id selector
- sets the letter colour
- align-items
- #end
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids