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.📱 The screen is 700px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 768px) {
p {
font-size: 6px;
}
} (a) No (b) Yes -
2.✍️ What value is given to color in this rule?
li {
margin: 10px;
color: red;
padding: 8px;
font-size: 20px;
} (a) color (b) 20px (c) center (d) red -
3.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 230px;
justify-content: flex-start;
}
Inside are 3 boxes, each 60px wide (no margins). - 4.🌈 Hex digits go 0 to 9, then A to which letter? (a) J (b) Z (c) F (d) G
- 5.💪 Which justify-content value puts boxes in the middle? (a) flex-end (b) flex-start (c) space-between (d) center
- 6.🧩 Which language makes a link? (a) HTML (b) CSS (c) JavaScript
- 7.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the first one (c) the shorter one (d) the later one
-
8.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (max-width: 1024px) {
p {
font-size: 22px;
}
} -
9.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 600px) {
p {
font-size: 6px;
}
} - 10.Which of these is the border? (a) space inside the border (b) the line round the box (c) the gap to other boxes (d) space outside the border
-
11.📱 The screen is 540px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (min-width: 768px) {
p {
font-size: 24px;
}
} (a) Yes (b) No - 12.📦 In the box model, which part is the gap to other boxes? (a) border (b) margin (c) content (d) padding
-
13.✍️ Which property is set to 300px in this rule?
h2 {
width: 300px;
font-style: italic;
color: red;
margin: 10px;
} (a) color (b) width (c) 300px (d) font-style - 14.🎯 Which element does the selector .star style? (a) <h1 class="menu"> (b) <h2 class="note"> (c) <h1 class="star"> (d) <h1 id="star">
- 15.⚖️ Which selector is the strongest? (a) an id selector (b) a class selector (c) an element selector
-
16.📱 The screen is 540px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (max-width: 480px) {
p {
font-size: 20px;
}
} (a) Yes (b) No - 17.🎯 Which element does the selector #top style? (a) <li class="top"> (b) <li id="intro"> (c) <li id="top"> (d) <div class="menu">
-
18.⚖️ What colour is the text of this element?
<p class="box" id="intro">Hi</p>
CSS:
p { color: yellow; }
p { color: white; } (a) orange (b) yellow (c) green (d) white - 19.📱 max-width: 600px applies when the screen is ___. (a) 600px or wider (b) exactly 1000px (c) turned off (d) 600px or narrower
- 20.📱 Responsive design means a page ___. (a) fits every screen (b) is only for laptops (c) has no pictures (d) never changes
-
21.✍️ How many declarations (property: value pairs) are in this rule?
.box {
border: 2px solid;
font-weight: bold;
font-style: italic;
} - 22.🎯 Which element does the selector #intro style? (a) <span class="intro"> (b) <span id="main"> (c) <p class="big"> (d) <span id="intro">
- 23.🎯 What kind of selector is .big? (a) an id selector (b) a class selector (c) an element selector
-
24.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 50px;
padding: 25px;
border: 1px solid black;
margin: 15px;
} - 25.✍️ In color: blue; which part is the value? (a) color (b) blue (c) ; (d) :
-
26.⚖️ What colour is the text of this element?
<h1 class="box" id="logo">Hi</h1>
CSS:
#logo { color: yellow; }
.box { color: black; } (a) black (b) yellow (c) red (d) blue -
27.🖌️ What colour are the letters?
p {
background-color: black;
color: orange;
text-align: right;
font-size: 12px;
} (a) black (b) green (c) orange - 28.🖌️ Which CSS property picks the font style? (a) color (b) background-color (c) font-family (d) font-weight
- 29.🎨 What does CSS stand for? (a) Computer Style Sheets (b) Creative Sheet System (c) Colourful Site Styles (d) Cascading Style Sheets
- 30.True or false: .note is an id selector. (a) True (b) False
- 31.🎨 A CSS file usually ends with which extension? (a) .png (b) .css (c) .html (d) .js
- 32.🔍 Which is the odd one out? (a) reacts to a button click (b) gives the page structure (c) puts a picture on a page (d) makes a form box
-
33.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 220px;
justify-content: flex-start;
}
Inside are 3 boxes, each 60px wide (no margins). -
34.🖌️ What colour are the letters?
h2 {
text-align: left;
color: red;
background-color: purple;
font-size: 40px;
} (a) white (b) red (c) purple -
35.📱 The screen is 820px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (min-width: 768px) {
p {
font-size: 22px;
}
} (a) Yes (b) No -
36.🖌️ Where does the text sit on its line?
li {
text-align: right;
font-size: 16px;
background-color: red;
color: blue;
} (a) on the left (b) in the middle (c) on the right - 37.🌈 In #0000dd the blue part is the hex number dd. What is it as a normal number?
-
38.📱 The screen is 1366px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 480px) {
p {
font-size: 28px;
}
} (a) No (b) Yes - 39.🌈 What is the biggest number one colour can have in rgb()? (a) 99 (b) 100 (c) 1000 (d) 255
-
40.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 1024px) {
p {
font-size: 6px;
}
}
Answer key
- Yes
- red
- 50
- F
- center
- HTML
- the later one
- 22
- 12
- the line round the box
- No
- margin
- width
- <h1 class="star">
- an id selector
- No
- <li id="top">
- white
- 600px or narrower
- fits every screen
- 3
- <span id="intro">
- a class selector
- 132
- blue
- yellow
- orange
- font-family
- Cascading Style Sheets
- False
- .css
- reacts to a button click
- 40
- red
- Yes
- on the right
- 221
- Yes
- 255
- 6
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids