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 tag connects an outside CSS file? (a) <a> (b) <css> (c) <link> (d) <img>
-
2.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (max-width: 768px) {
p {
font-size: 18px;
}
} (a) No (b) Yes - 3.📱 Responsive design means a page ___. (a) fits every screen (b) never changes (c) is only for laptops (d) has no pictures
- 4.📦 In the box model, which part is the text or picture? (a) border (b) padding (c) margin (d) content
-
5.📱 The screen is 540px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (min-width: 600px) {
p {
font-size: 14px;
}
} (a) No (b) Yes - 6.💪 Which flexbox property turns on flexbox? (a) display: flex (b) justify-content (c) gap (d) align-items
-
7.✍️ How many declarations (property: value pairs) are in this rule?
h1 {
padding: 8px;
text-align: center;
} - 8.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the first one (b) the shorter one (c) neither (d) the later one
-
9.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 600px) {
p {
font-size: 14px;
}
} -
10.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 240px;
justify-content: flex-start;
}
Inside are 2 boxes, each 80px wide (no margins). -
11.⚖️ What colour is the text of this element?
<h2 class="box" id="main">Hi</h2>
CSS:
h2 { color: yellow; }
#main { color: black; }
.box { color: green; } (a) purple (b) yellow (c) green (d) black -
12.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 768px) {
p {
font-size: 14px;
}
} - 13.True or false: .menu is a class selector. (a) True (b) False
-
14.⚖️ What colour is the text of this element?
<p class="note" id="end">Hi</p>
CSS:
#end { color: purple; }
.note { color: black; } (a) blue (b) red (c) purple (d) black -
15.✍️ What value is given to border in this rule?
li {
border: 2px solid;
font-weight: bold;
background-color: yellow;
} (a) 300px (b) 2px solid (c) italic (d) border -
16.🎯 Which CSS selector matches this element?
<p class="note" id="end">Hello</p> (a) #end (b) .end (c) .big (d) #hero -
17.✍️ What value is given to margin in this rule?
li {
text-align: center;
font-weight: bold;
margin: 10px;
} (a) 10px (b) margin (c) 8px (d) bold -
18.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 190px;
justify-content: flex-end;
}
Inside are 2 boxes, each 80px wide (no margins). - 19.True or false: HTML gives the page structure. (a) True (b) False
- 20.What does font-size do? (a) makes the text bold (b) sets the letter colour (c) colours behind the text (d) makes letters bigger
-
21.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 380px;
justify-content: center;
}
Inside are 3 boxes, each 80px wide (no margins). - 22.True or false: p is an id selector. (a) True (b) False
- 23.💪 Which flexbox property spaces boxes along a row? (a) gap (b) flex-direction (c) display: flex (d) justify-content
- 24.True or false: #top is an id selector. (a) True (b) False
- 25.🔍 Which is the odd one out? (a) makes a link (b) rounds box corners (c) puts a picture on a page (d) makes a form box
- 26.🎯 What kind of selector is h1? (a) an id selector (b) an element selector (c) a class selector
- 27.🎯 What kind of selector is body? (a) an element selector (b) an id selector (c) a class selector
-
28.🎯 Which CSS selector matches this element?
<li class="note" id="main">Hello</li> (a) #logo (b) div (c) li (d) .big - 29.🎯 What kind of selector is .big? (a) a class selector (b) an id selector (c) an element selector
- 30.🌈 In #rrggbb, which colour do the first two digits give? (a) green (b) black (c) blue (d) red
- 31.Which of these does JavaScript do? (a) shows a pop-up message (b) changes the text size (c) makes a link (d) makes headings and lists
- 32.🧩 Which language makes a link? (a) CSS (b) HTML (c) JavaScript
-
33.⚖️ What colour is the text of this element?
<h1 class="note" id="hero">Hi</h1>
CSS:
#hero { color: purple; }
h1 { color: orange; } (a) orange (b) red (c) yellow (d) purple - 34.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) turned off (c) 800px or wider (d) exactly 100px
- 35.📦 In the box model, which part is space outside the border? (a) margin (b) content (c) padding (d) border
- 36.True or false: JavaScript puts a picture on a page. (a) False (b) True
- 37.What does font-family do? (a) sets the letter colour (b) picks the font style (c) colours behind the text (d) makes the text bold
-
38.✍️ What is the selector in this CSS rule?
body {
font-weight: bold;
margin: 10px;
} (a) .box (b) body (c) font-weight (d) 10px - 39.🌈 Which colour is #0000ff? (a) bright green (b) blue (c) red (d) yellow
- 40.🖌️ Which CSS property picks the font style? (a) font-family (b) font-size (c) font-weight (d) color
Answer key
- <link>
- Yes
- fits every screen
- content
- No
- display: flex
- 2
- the later one
- 16
- 80
- black
- 14
- True
- purple
- 2px solid
- #end
- 10px
- 30
- True
- makes letters bigger
- 70
- False
- justify-content
- True
- rounds box corners
- an element selector
- an element selector
- li
- a class selector
- red
- shows a pop-up message
- HTML
- purple
- 800px or wider
- margin
- False
- picks the font style
- body
- blue
- font-family
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids