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?
<h2 class="note" id="main">Hi</h2>
CSS:
#main { color: green; }
#main { color: white; } (a) white (b) green (c) orange (d) purple - 2.🎯 Which element does the selector .red style? (a) <li class="star"> (b) <h2 id="red"> (c) <h2 class="box"> (d) <h2 class="red">
- 3.True or false: .card is an id selector. (a) True (b) False
- 4.✍️ In color: blue; which part is the value? (a) ; (b) : (c) blue (d) color
- 5.What does font-size do? (a) sets the letter colour (b) colours behind the text (c) picks the font style (d) makes letters bigger
-
6.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 110px;
padding: 20px;
border: 2px solid black;
margin: 10px;
} - 7.📦 In the box model, which part is the line round the box? (a) padding (b) content (c) border (d) margin
- 8.🖌️ Which CSS property picks the font style? (a) font-size (b) font-family (c) background-color (d) font-weight
- 9.📱 min-width: 800px applies when the screen is ___. (a) exactly 100px (b) 800px or wider (c) 800px or narrower (d) turned off
-
10.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 110px;
padding: 10px;
border: 3px solid black;
margin: 15px;
} - 11.🔍 Which is the odd one out? (a) puts a picture on a page (b) gives the page structure (c) makes a form box (d) sets colours and fonts
- 12.✍️ Which sign goes between a property and its value? (a) = (b) ; (c) : (d) -
- 13.📱 Which tag helps phones show a page at the right size? (a) the hr tag (b) the br tag (c) the title tag (d) the viewport meta tag
- 14.True or false: CSS changes the text size. (a) False (b) True
- 15.🧩 Which language makes a link? (a) JavaScript (b) CSS (c) HTML
- 16.🌈 What is the biggest number one colour can have in rgb()? (a) 99 (b) 100 (c) 255 (d) 1000
- 17.True or false: the border is a solid or dotted edge. (a) False (b) True
- 18.🌈 Which colour is #0000ff? (a) black (b) bright green (c) yellow (d) blue
-
19.🖌️ How big is the text, in px?
h2 {
font-size: 20px;
text-align: center;
color: green;
background-color: orange;
} - 20.🎯 Which element does the selector #intro style? (a) <li id="intro"> (b) <li class="intro"> (c) <div class="big"> (d) <li id="main">
-
21.⚖️ What colour is the text of this element?
<h1 class="menu" id="logo">Hi</h1>
CSS:
.menu { color: green; }
h1 { color: blue; }
#logo { color: black; } (a) yellow (b) green (c) black (d) blue -
22.🎯 Which CSS selector matches this element?
<p class="menu" id="hero">Hello</p> (a) p (b) h1 (c) #top (d) .hero -
23.📱 The screen is 540px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (max-width: 480px) {
p {
font-size: 18px;
}
} (a) No (b) Yes - 24.True or false: JavaScript makes a form box. (a) False (b) True
- 25.💪 Which flexbox property lines boxes up across? (a) align-items (b) gap (c) justify-content (d) flex-direction
-
26.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 100px;
padding: 10px;
border: 4px solid black;
margin: 0px;
} - 27.🎯 What kind of selector is p? (a) an id selector (b) a class selector (c) an element selector
- 28.True or false: .card is an element selector. (a) True (b) False
-
29.⚖️ What colour is the text of this element?
<h2 class="big" id="hero">Hi</h2>
CSS:
#hero { color: yellow; }
#hero { color: black; } (a) purple (b) blue (c) yellow (d) black -
30.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (max-width: 768px) {
p {
font-size: 20px;
}
} (a) No (b) Yes - 31.🌈 Which hex code is black? (a) #ffff00 (b) #00ff00 (c) #00ffff (d) #000000
-
32.✍️ Which property is set to 10px in this rule?
h1 {
width: 300px;
margin: 10px;
border: 2px solid;
} (a) 10px (b) font-weight (c) padding (d) margin -
33.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 220px;
justify-content: space-between;
}
Inside are 2 boxes, each 80px wide (no margins). -
34.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 110px;
padding: 15px;
border: 3px solid black;
margin: 20px;
} - 35.🌈 Which hex code is white? (a) #00ffff (b) #ffffff (c) #000000 (d) #ffff00
- 36.True or false: JavaScript shows a pop-up message. (a) True (b) False
- 37.True or false: margin is the gap to other boxes. (a) False (b) True
-
38.🖌️ Where does the text sit on its line?
h1 {
background-color: orange;
color: blue;
text-align: right;
font-size: 12px;
} (a) on the right (b) in the middle (c) on the left -
39.✍️ What is the selector in this CSS rule?
#top {
border: 2px solid;
margin: 10px;
text-align: center;
} (a) border (b) #top (c) 10px (d) li - 40.🌈 Which colour is #ff0000? (a) white (b) red (c) yellow (d) black
Answer key
- white
- <h2 class="red">
- False
- blue
- makes letters bigger
- 174
- border
- font-family
- 800px or wider
- 166
- sets colours and fonts
- :
- the viewport meta tag
- True
- HTML
- 255
- True
- blue
- 20
- <li id="intro">
- black
- p
- No
- False
- align-items
- 128
- an element selector
- False
- black
- Yes
- #000000
- margin
- 60
- 186
- #ffffff
- True
- True
- on the right
- #top
- red
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids