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 of these is margin? (a) a solid or dotted edge (b) the line round the box (c) space inside the border (d) space outside the border
- 2.🎯 Which element does the selector .box style? (a) <span class="menu"> (b) <div class="star"> (c) <div class="box"> (d) <div id="box">
- 3.🌈 Which colour is #ffffff? (a) bright green (b) blue (c) cyan (d) white
- 4.✍️ Which sign ends each CSS declaration? (a) , (b) . (c) : (d) ;
- 5.💪 Which justify-content value packs boxes at the start? (a) center (b) flex-end (c) flex-start (d) space-between
- 6.🖌️ Which CSS property sets the letter colour? (a) text-align (b) font-family (c) color (d) font-size
-
7.📱 The screen is 820px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (min-width: 600px) {
p {
font-size: 24px;
}
} (a) No (b) Yes -
8.✍️ What is the selector in this CSS rule?
body {
background-color: yellow;
border: 2px solid;
} (a) background-color (b) .box (c) body (d) 2px solid - 9.Which of these does JavaScript do? (a) gives the page structure (b) changes the text size (c) checks a quiz answer (d) makes headings and lists
-
10.🖌️ Where does the text sit on its line?
h2 {
background-color: purple;
font-size: 20px;
color: yellow;
text-align: right;
} (a) on the left (b) in the middle (c) on the right -
11.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 280px;
padding: 20px;
border: 1px solid black;
margin: 0px;
} -
12.✍️ Which property is set to italic in this rule?
li {
margin: 10px;
color: red;
font-style: italic;
} (a) color (b) font-size (c) italic (d) font-style - 13.True or false: #main is an id selector. (a) True (b) False
- 14.What does font-weight do? (a) makes letters bigger (b) makes the text bold (c) colours behind the text (d) sets the letter colour
-
15.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (min-width: 600px) {
p {
font-size: 22px;
}
} (a) Yes (b) No - 16.🎯 Which element does the selector p style? (a) <h1> (b) <p class="box"> (c) <h2 class="box"> (d) <li id="logo">
-
17.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 140px;
justify-content: center;
}
Inside are 2 boxes, each 50px wide (no margins). - 18.🌈 Which colour of light is strongest in rgb(176, 97, 129)? (a) blue (b) green (c) red
- 19.🌈 In #004e00 the green part is the hex number 4e. What is it as a normal number?
- 20.True or false: JavaScript checks a quiz answer. (a) True (b) False
- 21.✍️ Which sign goes between a property and its value? (a) ; (b) = (c) - (d) :
-
22.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 70px;
padding: 30px;
border: 4px solid black;
margin: 5px;
} - 23.🎯 Which element does the selector span style? (a) <h2 id="intro"> (b) <span class="menu"> (c) <h1 class="menu"> (d) <p>
- 24.True or false: li is an id selector. (a) False (b) True
- 25.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) 800px or wider (c) turned off (d) exactly 100px
- 26.🧩 Which language shows a pop-up message? (a) JavaScript (b) HTML (c) CSS
-
27.✍️ How many declarations (property: value pairs) are in this rule?
h1 {
font-size: 20px;
font-style: italic;
border: 2px solid;
} - 28.True or false: #logo is a class selector. (a) True (b) False
-
29.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (min-width: 1024px) {
p {
font-size: 14px;
}
} -
30.🖌️ What colour are the letters?
h2 {
background-color: blue;
font-size: 32px;
text-align: right;
color: black;
} (a) purple (b) blue (c) black - 31.🎨 One CSS file can style how many pages? (a) only one word (b) only one image (c) no pages (d) many pages
- 32.🎯 Can many elements share the same class? (a) No (b) Yes
- 33.What does background-color do? (a) centres a heading (b) makes the text bold (c) picks the font style (d) colours behind the text
-
34.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 200px;
justify-content: flex-start;
}
Inside are 2 boxes, each 60px wide (no margins). -
35.📱 The screen is 1366px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 480px) {
p {
font-size: 14px;
}
} (a) No (b) Yes -
36.📱 The screen is 414px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (min-width: 480px) {
p {
font-size: 28px;
}
} (a) No (b) Yes - 37.📦 In the box model, which part is the gap to other boxes? (a) padding (b) content (c) border (d) margin
-
38.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 150px;
padding: 20px;
border: 3px solid black;
margin: 15px;
} - 39.🎯 What kind of selector is img? (a) a class selector (b) an id selector (c) an element selector
-
40.✍️ Which property is set to red in this rule?
.note {
color: red;
background-color: yellow;
} (a) font-size (b) color (c) red (d) text-align
Answer key
- space outside the border
- <div class="box">
- white
- ;
- flex-start
- color
- Yes
- body
- checks a quiz answer
- on the right
- 322
- font-style
- True
- makes the text bold
- No
- <p class="box">
- 20
- red
- 78
- True
- :
- 138
- <span class="menu">
- False
- 800px or wider
- JavaScript
- 3
- False
- 12
- black
- many pages
- Yes
- colours behind the text
- 80
- No
- No
- margin
- 226
- an element selector
- color
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids