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 is the biggest number one colour can have in rgb()? (a) 1000 (b) 100 (c) 255 (d) 99
-
2.📱 The screen is 540px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 600px) {
p {
font-size: 10px;
}
} (a) Yes (b) No - 3.🎨 Which tag connects an outside CSS file? (a) <a> (b) <css> (c) <link> (d) <img>
- 4.🎯 How many elements on a page should have the same id? (a) 5 (b) 2 (c) 1 (d) any number
- 5.✍️ In color: blue; which part is the value? (a) ; (b) : (c) blue (d) color
- 6.🌈 In #rrggbb, which colour do the last two digits give? (a) blue (b) white (c) green (d) red
- 7.🎯 Which element does the selector .note style? (a) <li class="big"> (b) <li class="note"> (c) <li id="note"> (d) <div class="red">
-
8.🖌️ What colour is behind the letters?
li {
color: red;
text-align: center;
background-color: black;
font-size: 16px;
} (a) red (b) black (c) purple - 9.True or false: the content is the gap to other boxes. (a) False (b) True
- 10.True or false: HTML makes a form box. (a) False (b) True
- 11.True or false: #hero is an element selector. (a) False (b) True
- 12.🌈 Which hex code is black? (a) #000000 (b) #ff00ff (c) #ffffff (d) #0000ff
-
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: 210px;
padding: 15px;
border: 1px solid black;
margin: 5px;
} -
14.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 420px;
justify-content: center;
}
Inside are 4 boxes, each 100px wide (no margins). -
15.✍️ What value is given to margin in this rule?
h2 {
margin: 10px;
color: red;
} (a) 10px (b) margin (c) 8px (d) bold - 16.What does justify-content: flex-end do? (a) packs boxes at the start (b) puts boxes in the middle (c) packs boxes at the end (d) equal gaps, none at ends
-
17.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (min-width: 600px) {
p {
font-size: 16px;
}
} - 18.🌈 Which colour of light is strongest in rgb(74, 121, 241)? (a) blue (b) red (c) green
-
19.⚖️ What colour is the text of this element?
<p class="red" id="hero">Hi</p>
CSS:
p { color: orange; }
p { color: black; } (a) purple (b) green (c) black (d) orange -
20.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 600px) {
p {
font-size: 10px;
}
} - 21.💪 Which justify-content value packs boxes at the start? (a) flex-end (b) flex-start (c) space-between (d) center
-
22.⚖️ What colour is the text of this element?
<h2 class="box" id="intro">Hi</h2>
CSS:
#intro { color: red; }
#intro { color: orange; } (a) blue (b) red (c) orange (d) purple - 23.🌈 Which colour is #00ffff? (a) blue (b) yellow (c) red (d) cyan
- 24.What does font-size do? (a) makes letters bigger (b) colours behind the text (c) sets the letter colour (d) makes the text bold
- 25.✍️ In color: blue; which part is the property? (a) : (b) ; (c) color (d) blue
- 26.💪 Which justify-content value packs boxes at the end? (a) space-between (b) center (c) flex-start (d) flex-end
- 27.True or false: the content is the text or picture. (a) True (b) False
- 28.🧩 Which language checks a quiz answer? (a) CSS (b) JavaScript (c) HTML
- 29.📦 In the box model, which part is the line round the box? (a) content (b) margin (c) padding (d) border
-
30.📱 The screen is 1366px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 768px) {
p {
font-size: 12px;
}
} (a) No (b) Yes - 31.⚖️ Which selector is the weakest? (a) an id selector (b) an element selector (c) a class selector
- 32.What does font-weight do? (a) colours behind the text (b) makes letters bigger (c) sets the letter colour (d) makes the text bold
- 33.🎯 Which element does the selector .menu style? (a) <div class="note"> (b) <span class="big"> (c) <div class="menu"> (d) <div id="menu">
- 34.💪 Which flexbox property sets space between boxes? (a) flex-direction (b) display: flex (c) justify-content (d) gap
- 35.🌈 Which colour is rgb(0, 0, 0)? (a) yellow (b) blue (c) black (d) white
- 36.True or false: padding is space inside the border. (a) False (b) True
-
37.⚖️ What colour is the text of this element?
<h1 class="box" id="end">Hi</h1>
CSS:
h1 { color: white; }
h1 { color: red; } (a) white (b) black (c) red (d) yellow - 38.🖌️ Which CSS property colours behind the text? (a) color (b) background-color (c) font-family (d) font-size
-
39.🎯 Which CSS selector matches this element?
<h2 class="red" id="hero">Hello</h2> (a) .box (b) #top (c) .hero (d) h2 - 40.True or false: margin is space inside the border. (a) False (b) True
Answer key
- 255
- Yes
- <link>
- 1
- blue
- blue
- <li class="note">
- black
- False
- True
- False
- #000000
- 242
- 10
- 10px
- packs boxes at the end
- 12
- blue
- black
- 16
- flex-start
- orange
- cyan
- makes letters bigger
- color
- flex-end
- True
- JavaScript
- border
- No
- an element selector
- makes the text bold
- <div class="menu">
- gap
- black
- True
- red
- background-color
- h2
- False
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids