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.🌈 Which colour is rgb(255, 0, 0)? (a) magenta (b) black (c) bright green (d) red
-
2.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (min-width: 768px) {
p {
font-size: 26px;
}
} -
3.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 150px;
padding: 25px;
border: 2px solid black;
margin: 10px;
} - 4.🔍 Which is the odd one out? (a) changes the text size (b) makes a form box (c) rounds box corners (d) lays out the page
- 5.🌈 Which colour is #0000ff? (a) black (b) blue (c) white (d) yellow
- 6.🌈 Which colour is #000000? (a) red (b) bright green (c) blue (d) black
- 7.🧩 Which language checks a quiz answer? (a) CSS (b) JavaScript (c) HTML
- 8.🖌️ Which CSS property centres a heading? (a) font-family (b) text-align (c) font-weight (d) font-size
-
9.⚖️ What colour is the text of this element?
<h2 class="red" id="intro">Hi</h2>
CSS:
h2 { color: yellow; }
#intro { color: red; } (a) black (b) white (c) red (d) yellow - 10.📱 min-width: 800px applies when the screen is ___. (a) exactly 100px (b) 800px or wider (c) turned off (d) 800px or narrower
-
11.🖌️ What colour are the letters?
h2 {
color: red;
background-color: black;
font-size: 36px;
text-align: right;
} (a) green (b) red (c) black -
12.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 120px;
padding: 5px;
border: 1px solid black;
margin: 20px;
} -
13.⚖️ What colour is the text of this element?
<h2 class="menu" id="hero">Hi</h2>
CSS:
#hero { color: blue; }
#hero { color: white; } (a) black (b) purple (c) white (d) blue -
14.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 480px) {
p {
font-size: 18px;
}
} -
15.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 640px;
justify-content: space-between;
}
Inside are 4 boxes, each 100px wide (no margins). -
16.✍️ How many declarations (property: value pairs) are in this rule?
h2 {
margin: 10px;
color: red;
border: 2px solid;
} -
17.🖌️ What colour are the letters?
h2 {
text-align: center;
color: red;
background-color: purple;
font-size: 24px;
} (a) red (b) white (c) purple -
18.📱 The screen is 414px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (min-width: 768px) {
p {
font-size: 20px;
}
} (a) Yes (b) No - 19.💪 Which justify-content value puts boxes in the middle? (a) flex-start (b) space-between (c) flex-end (d) center
-
20.✍️ Which property is set to 300px in this rule?
p {
font-style: italic;
width: 300px;
text-align: center;
border: 2px solid;
} (a) width (b) font-style (c) color (d) 300px -
21.📱 The screen is 700px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (max-width: 600px) {
p {
font-size: 16px;
}
} (a) No (b) Yes - 22.🖌️ Which CSS property sets the letter colour? (a) color (b) font-weight (c) text-align (d) background-color
-
23.⚖️ What colour is the text of this element?
<p class="red" id="top">Hi</p>
CSS:
#top { color: black; }
p { color: yellow; }
.red { color: red; } (a) black (b) red (c) yellow (d) orange - 24.🌈 Which colour is rgb(255, 0, 255)? (a) black (b) bright green (c) yellow (d) magenta
- 25.✍️ Which sign goes between a property and its value? (a) = (b) ; (c) - (d) :
- 26.💪 Which justify-content value packs boxes at the start? (a) flex-end (b) flex-start (c) space-between (d) center
-
27.🖌️ What colour are the letters?
h2 {
background-color: orange;
color: purple;
font-size: 24px;
text-align: left;
} (a) white (b) orange (c) purple -
28.✍️ Which property is set to center in this rule?
body {
text-align: center;
font-style: italic;
} (a) background-color (b) margin (c) center (d) text-align - 29.📱 What does a media query check? (a) the time of day (b) the battery level (c) the screen width (d) the page title
-
30.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 180px;
justify-content: space-between;
}
Inside are 2 boxes, each 50px wide (no margins). -
31.✍️ How many declarations (property: value pairs) are in this rule?
p {
font-size: 20px;
background-color: yellow;
} - 32.True or false: padding is space inside the border. (a) True (b) False
- 33.🌈 Hex digits go 0 to 9, then A to which letter? (a) Z (b) G (c) J (d) F
- 34.📦 In the box model, which part is space inside the border? (a) content (b) margin (c) padding (d) border
-
35.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 110px;
justify-content: space-between;
}
Inside are 2 boxes, each 40px wide (no margins). - 36.⚖️ Which selector is the strongest? (a) a class selector (b) an element selector (c) an id selector
-
37.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 1024px) {
p {
font-size: 30px;
}
} - 38.🎯 What kind of selector is li? (a) a class selector (b) an id selector (c) an element selector
- 39.📱 Which tag helps phones show a page at the right size? (a) the title tag (b) the br tag (c) the viewport meta tag (d) the hr tag
- 40.🎨 Which tag holds CSS inside the head? (a) <script> (b) <body> (c) <style> (d) <css>
Answer key
- red
- 20
- 204
- makes a form box
- blue
- black
- JavaScript
- text-align
- red
- 800px or wider
- red
- 172
- white
- 20
- 80
- 3
- red
- No
- center
- width
- No
- color
- black
- magenta
- :
- flex-start
- purple
- text-align
- the screen width
- 80
- 2
- True
- F
- padding
- 30
- an id selector
- 24
- an element selector
- the viewport meta tag
- <style>
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids