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.True or false: .note is a class selector. (a) True (b) False
-
2.📦 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: 30px;
border: 3px solid black;
margin: 0px;
} -
3.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 768px) {
p {
font-size: 10px;
}
} -
4.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (max-width: 600px) {
p {
font-size: 20px;
}
} - 5.🎯 Which element does the selector #logo style? (a) <li class="logo"> (b) <li id="end"> (c) <div class="box"> (d) <li id="logo">
- 6.🖌️ Which CSS property picks the font style? (a) font-family (b) background-color (c) color (d) font-weight
- 7.🔍 Which is the odd one out? (a) changes the page live (b) makes a link (c) checks a quiz answer (d) reacts to a button click
- 8.🎨 What does CSS stand for? (a) Colourful Site Styles (b) Cascading Style Sheets (c) Computer Style Sheets (d) Creative Sheet System
- 9.📦 In the box model, which part is the gap round content? (a) margin (b) padding (c) border (d) content
- 10.🎯 Can many elements share the same class? (a) Yes (b) No
- 11.🔍 Which is the odd one out? (a) adds space around boxes (b) makes a form box (c) changes the text size (d) sets colours and fonts
-
12.⚖️ What colour is the text of this element?
<p class="red" id="main">Hi</p>
CSS:
#main { color: white; }
#main { color: black; } (a) white (b) red (c) black (d) purple - 13.True or false: the content is the text or picture. (a) False (b) True
-
14.💪 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). -
15.⚖️ What colour is the text of this element?
<h2 class="red" id="top">Hi</h2>
CSS:
h2 { color: yellow; }
h2 { color: purple; } (a) black (b) purple (c) white (d) yellow -
16.✍️ What value is given to padding in this rule?
li {
padding: 8px;
text-align: center;
font-style: italic;
border: 2px solid;
} (a) padding (b) 8px (c) bold (d) 2px solid - 17.🎯 Which element does the selector h1 style? (a) <h1 class="big"> (b) <h2> (c) <div id="end"> (d) <li class="big">
-
18.⚖️ What colour is the text of this element?
<h1 class="note" id="top">Hi</h1>
CSS:
.note { color: green; }
.note { color: purple; } (a) orange (b) green (c) white (d) purple - 19.🎨 Which tag connects an outside CSS file? (a) <css> (b) <img> (c) <link> (d) <a>
- 20.🎯 What kind of selector is #end? (a) an id selector (b) an element selector (c) a class selector
- 21.Which of these is margin? (a) space outside the border (b) the text or picture (c) the gap round content (d) space inside the border
- 22.🧩 Which language changes the page live? (a) HTML (b) JavaScript (c) CSS
- 23.📱 Which tag helps phones show a page at the right size? (a) the br tag (b) the hr tag (c) the title tag (d) the viewport meta tag
-
24.🖌️ What colour are the letters?
p {
text-align: center;
background-color: white;
color: black;
font-size: 16px;
} (a) blue (b) black (c) white -
25.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 340px;
justify-content: center;
}
Inside are 3 boxes, each 60px wide (no margins). - 26.True or false: p is an element selector. (a) True (b) False
- 27.True or false: the content is space outside the border. (a) False (b) True
- 28.🧩 Which language changes the text size? (a) JavaScript (b) HTML (c) CSS
-
29.🖌️ What colour is behind the letters?
h2 {
text-align: center;
font-size: 36px;
background-color: red;
color: yellow;
} (a) red (b) yellow (c) black - 30.🌈 Which colour of light is strongest in rgb(107, 196, 10)? (a) green (b) blue (c) red
-
31.✍️ What value is given to padding in this rule?
.note {
padding: 8px;
color: red;
} (a) padding (b) bold (c) 8px (d) 2px solid - 32.⚖️ Which selector is the weakest? (a) an element selector (b) a class selector (c) an id selector
- 33.Which of these is the border? (a) a solid or dotted edge (b) the gap round content (c) the text or picture (d) space outside the border
- 34.🎯 What kind of selector is #top? (a) a class selector (b) an id selector (c) an element selector
-
35.✍️ How many declarations (property: value pairs) are in this rule?
.note {
padding: 8px;
font-size: 20px;
} - 36.🎯 What kind of selector is .card? (a) an id selector (b) an element selector (c) a class selector
- 37.📱 Responsive design means a page ___. (a) is only for laptops (b) never changes (c) fits every screen (d) has no pictures
- 38.True or false: .card is a class selector. (a) False (b) True
-
39.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 180px;
padding: 5px;
border: 3px solid black;
margin: 0px;
} -
40.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 300px;
justify-content: center;
}
Inside are 3 boxes, each 80px wide (no margins).
Answer key
- True
- 216
- 12
- 20
- <li id="logo">
- font-family
- makes a link
- Cascading Style Sheets
- padding
- Yes
- makes a form box
- black
- True
- 80
- purple
- 8px
- <h1 class="big">
- purple
- <link>
- an id selector
- space outside the border
- JavaScript
- the viewport meta tag
- black
- 80
- True
- False
- CSS
- red
- green
- 8px
- an element selector
- a solid or dotted edge
- an id selector
- 2
- a class selector
- fits every screen
- True
- 196
- 30
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids