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 holds CSS inside the head? (a) <script> (b) <body> (c) <style> (d) <css>
- 2.True or false: li is a class selector. (a) False (b) True
- 3.🎯 What kind of selector is p? (a) an element selector (b) a class selector (c) an id selector
-
4.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 210px;
padding: 30px;
border: 5px solid black;
margin: 5px;
} -
5.✍️ Which property is set to yellow in this rule?
p {
background-color: yellow;
font-size: 20px;
} (a) yellow (b) background-color (c) margin (d) padding -
6.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (min-width: 480px) {
p {
font-size: 28px;
}
} -
7.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 600px) {
p {
font-size: 6px;
}
} - 8.Which of these is padding? (a) the text or picture (b) a solid or dotted edge (c) the gap to other boxes (d) space inside the border
- 9.🔍 Which is the odd one out? (a) reacts to a button click (b) makes headings and lists (c) changes the page live (d) checks a quiz answer
-
10.🖌️ How big is the text, in px?
h1 {
color: red;
text-align: center;
background-color: orange;
font-size: 40px;
} -
11.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 240px;
justify-content: center;
}
Inside are 2 boxes, each 50px wide (no margins). - 12.True or false: margin is space outside the border. (a) False (b) True
- 13.📱 What does a media query check? (a) the page title (b) the time of day (c) the battery level (d) the screen width
-
14.🖌️ What colour are the letters?
h2 {
background-color: orange;
text-align: center;
color: purple;
font-size: 12px;
} (a) orange (b) purple (c) red - 15.🔍 Which is the odd one out? (a) makes headings and lists (b) makes a form box (c) shows a pop-up message (d) gives the page structure
-
16.📦 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: 5px;
border: 5px solid black;
margin: 20px;
} - 17.💪 Which justify-content value equal gaps, none at ends? (a) flex-end (b) center (c) space-between (d) flex-start
-
18.🖌️ What colour are the letters?
h2 {
color: blue;
font-size: 36px;
background-color: orange;
text-align: right;
} (a) red (b) orange (c) blue - 19.🎯 Can many elements share the same class? (a) Yes (b) No
-
20.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 130px;
justify-content: space-between;
}
Inside are 2 boxes, each 50px wide (no margins). -
21.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 260px;
justify-content: flex-end;
}
Inside are 3 boxes, each 80px wide (no margins). -
22.📱 The screen is 700px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (min-width: 1024px) {
p {
font-size: 24px;
}
} (a) No (b) Yes -
23.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 190px;
padding: 15px;
border: 4px solid black;
margin: 20px;
} - 24.🧩 Which language makes headings and lists? (a) JavaScript (b) HTML (c) CSS
- 25.🎯 Which sign starts an id selector? (a) . (b) # (c) & (d) @
- 26.🎯 Which sign starts a class selector? (a) & (b) . (c) @ (d) #
-
27.✍️ Which property is set to center in this rule?
li {
border: 2px solid;
font-style: italic;
text-align: center;
background-color: yellow;
} (a) margin (b) center (c) background-color (d) text-align - 28.🎯 Which element does the selector #intro style? (a) <div id="intro"> (b) <div class="intro"> (c) <span class="menu"> (d) <div id="main">
- 29.What does font-size do? (a) makes the text bold (b) sets the letter colour (c) makes letters bigger (d) colours behind the text
- 30.Which of these is the content? (a) space outside the border (b) a solid or dotted edge (c) the text or picture (d) the gap to other boxes
-
31.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 230px;
justify-content: center;
}
Inside are 3 boxes, each 50px wide (no margins). - 32.Which of these is margin? (a) a solid or dotted edge (b) the gap round content (c) space outside the border (d) the text or picture
- 33.🎯 What kind of selector is #logo? (a) an id selector (b) an element selector (c) a class selector
- 34.💪 Which flexbox property spaces boxes along a row? (a) flex-direction (b) gap (c) justify-content (d) display: flex
- 35.What does justify-content: flex-start do? (a) puts boxes in the middle (b) packs boxes at the start (c) equal gaps, none at ends (d) packs boxes at the end
- 36.✍️ In color: blue; which part is the value? (a) : (b) color (c) blue (d) ;
- 37.What does justify-content: space-between do? (a) puts boxes in the middle (b) packs boxes at the end (c) packs boxes at the start (d) equal gaps, none at ends
-
38.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 1024px) {
p {
font-size: 10px;
}
} - 39.True or false: HTML makes headings and lists. (a) True (b) False
- 40.🌈 Which hex code is blue? (a) #ffff00 (b) #000000 (c) #0000ff (d) #00ff00
Answer key
- <style>
- False
- an element selector
- 290
- background-color
- 28
- 12
- space inside the border
- makes headings and lists
- 40
- 70
- True
- the screen width
- purple
- shows a pop-up message
- 90
- space-between
- blue
- Yes
- 30
- 20
- No
- 228
- HTML
- #
- .
- text-align
- <div id="intro">
- makes letters bigger
- the text or picture
- 40
- space outside the border
- an id selector
- justify-content
- packs boxes at the start
- blue
- equal gaps, none at ends
- 10
- True
- #0000ff
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids