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.✍️ What is the selector in this CSS rule?
body {
background-color: yellow;
font-style: italic;
border: 2px solid;
} (a) body (b) italic (c) background-color (d) .box - 2.📱 Responsive design means a page ___. (a) has no pictures (b) never changes (c) fits every screen (d) is only for laptops
- 3.⚖️ Which selector is the strongest? (a) a class selector (b) an element selector (c) an id selector
- 4.Which of these is padding? (a) the line round the box (b) a solid or dotted edge (c) the text or picture (d) the gap round content
- 5.🔍 Which is the odd one out? (a) counts down a timer (b) makes a form box (c) reacts to a button click (d) checks a quiz answer
-
6.✍️ How many declarations (property: value pairs) are in this rule?
.box {
background-color: yellow;
margin: 10px;
color: red;
padding: 8px;
} -
7.✍️ What is the selector in this CSS rule?
h1 {
background-color: yellow;
margin: 10px;
font-size: 20px;
} (a) h1 (b) p (c) 10px (d) background-color -
8.⚖️ What colour is the text of this element?
<h2 class="red" id="end">Hi</h2>
CSS:
.red { color: black; }
h2 { color: red; } (a) black (b) orange (c) green (d) red -
9.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 160px;
justify-content: space-between;
}
Inside are 2 boxes, each 40px wide (no margins). - 10.📱 What does a media query check? (a) the battery level (b) the time of day (c) the screen width (d) the page title
- 11.💪 Which flexbox property picks row or column? (a) display: flex (b) flex-direction (c) gap (d) align-items
- 12.🌈 Which colour is rgb(0, 0, 255)? (a) blue (b) magenta (c) cyan (d) bright green
- 13.🌈 Which hex code is white? (a) #00ff00 (b) #ff0000 (c) #000000 (d) #ffffff
- 14.Which of these is the content? (a) the gap round content (b) the text or picture (c) space inside the border (d) a solid or dotted edge
- 15.🎯 Which element does the selector span style? (a) <h1 class="red"> (b) <h2 id="hero"> (c) <p> (d) <span class="red">
- 16.True or false: JavaScript checks a quiz answer. (a) True (b) False
- 17.🌈 Which colour of light is strongest in rgb(210, 123, 118)? (a) blue (b) red (c) green
-
18.🖌️ What colour are the letters?
li {
text-align: left;
background-color: orange;
font-size: 36px;
color: white;
} (a) red (b) white (c) orange - 19.🌈 Which hex code is bright green? (a) #0000ff (b) #00ff00 (c) #ffffff (d) #ff0000
-
20.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 280px;
padding: 30px;
border: 4px solid black;
margin: 20px;
} - 21.What does font-weight do? (a) makes the text bold (b) centres a heading (c) makes letters bigger (d) colours behind the text
-
22.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (max-width: 600px) {
p {
font-size: 22px;
}
} - 23.🌈 In #d70000 the red part is the hex number d7. What is it as a normal number?
- 24.💪 Which flexbox property turns on flexbox? (a) gap (b) display: flex (c) align-items (d) justify-content
- 25.🌈 Which colour of light is strongest in rgb(29, 199, 43)? (a) blue (b) red (c) green
-
26.💪 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). - 27.🎯 How many elements on a page should have the same id? (a) 2 (b) 1 (c) any number (d) 5
-
28.🎯 Which CSS selector matches this element?
<h2 class="menu" id="end">Hello</h2> (a) li (b) .end (c) .note (d) .menu -
29.✍️ What value is given to font-weight in this rule?
li {
font-weight: bold;
width: 300px;
font-size: 20px;
} (a) bold (b) 2px solid (c) 300px (d) font-weight - 30.🎯 Which element does the selector span style? (a) <span class="star"> (b) <h2 id="top"> (c) <h1 class="star"> (d) <p>
-
31.🖌️ What colour is behind the letters?
h1 {
background-color: blue;
font-size: 40px;
color: orange;
text-align: right;
} (a) orange (b) red (c) blue - 32.🌈 Which colour of light is strongest in rgb(30, 6, 232)? (a) green (b) blue (c) red
- 33.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the first one (b) the later one (c) neither (d) the shorter one
- 34.True or false: margin is the gap round content. (a) True (b) False
- 35.True or false: the content is the text or picture. (a) False (b) True
- 36.What does text-align do? (a) makes letters bigger (b) makes the text bold (c) centres a heading (d) sets the letter colour
- 37.🧩 Which language makes a link? (a) CSS (b) JavaScript (c) HTML
- 38.True or false: JavaScript gives the page structure. (a) True (b) False
-
39.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (min-width: 1024px) {
p {
font-size: 26px;
}
} - 40.🌈 In #4f0000 the red part is the hex number 4f. What is it as a normal number?
Answer key
- body
- fits every screen
- an id selector
- the gap round content
- makes a form box
- 4
- h1
- black
- 80
- the screen width
- flex-direction
- blue
- #ffffff
- the text or picture
- <span class="red">
- True
- red
- white
- #00ff00
- 348
- makes the text bold
- 24
- 215
- display: flex
- green
- 40
- 1
- .menu
- bold
- <span class="star">
- blue
- blue
- the later one
- False
- True
- centres a heading
- HTML
- False
- 20
- 79
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids