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.🌈 In #004600 the green part is the hex number 46. What is it as a normal number?
-
2.✍️ What is the selector in this CSS rule?
h1 {
margin: 10px;
background-color: yellow;
padding: 8px;
text-align: center;
} (a) margin (b) h1 (c) p (d) yellow - 3.🎨 Which tag connects an outside CSS file? (a) <a> (b) <css> (c) <img> (d) <link>
- 4.What does justify-content: center do? (a) puts boxes in the middle (b) packs boxes at the start (c) packs boxes at the end (d) equal gaps, none at ends
-
5.🖌️ What colour is behind the letters?
li {
background-color: orange;
font-size: 12px;
color: green;
text-align: center;
} (a) orange (b) green (c) purple -
6.📱 The screen is 1100px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (min-width: 480px) {
p {
font-size: 20px;
}
} (a) No (b) Yes - 7.Which of these does CSS do? (a) makes headings and lists (b) lays out the page (c) checks a quiz answer (d) gives the page structure
- 8.True or false: JavaScript checks a quiz answer. (a) True (b) False
-
9.⚖️ What colour is the text of this element?
<h1 class="star" id="intro">Hi</h1>
CSS:
.star { color: blue; }
.star { color: yellow; } (a) yellow (b) red (c) blue (d) orange - 10.True or false: JavaScript adds space around boxes. (a) True (b) False
- 11.✍️ How does a CSS comment start? (a) // (b) <!-- (c) # (d) /*
-
12.📱 The screen is 540px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (min-width: 480px) {
p {
font-size: 22px;
}
} (a) No (b) Yes - 13.🌈 Which colour of light is strongest in rgb(182, 61, 34)? (a) green (b) red (c) blue
- 14.📱 Responsive design means a page ___. (a) has no pictures (b) never changes (c) is only for laptops (d) fits every screen
- 15.🎯 Which element does the selector h2 style? (a) <h2 class="menu"> (b) <li> (c) <span id="top"> (d) <div class="menu">
- 16.🧩 Which language lays out the page? (a) HTML (b) CSS (c) JavaScript
-
17.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 768px) {
p {
font-size: 26px;
}
} - 18.🧩 Which language sets colours and fonts? (a) JavaScript (b) CSS (c) HTML
-
19.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (max-width: 480px) {
p {
font-size: 18px;
}
} (a) Yes (b) No - 20.What does color do? (a) picks the font style (b) centres a heading (c) colours behind the text (d) sets the letter colour
-
21.✍️ How many declarations (property: value pairs) are in this rule?
body {
width: 300px;
text-align: center;
border: 2px solid;
padding: 8px;
} - 22.⚖️ 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
- 23.📦 In the box model, which part is space outside the border? (a) padding (b) margin (c) content (d) border
-
24.🖌️ What colour are the letters?
h1 {
color: green;
text-align: center;
background-color: yellow;
font-size: 16px;
} (a) green (b) red (c) yellow - 25.🎯 What kind of selector is .note? (a) a class selector (b) an element selector (c) an id selector
- 26.💪 Which justify-content value packs boxes at the end? (a) flex-start (b) space-between (c) center (d) flex-end
-
27.✍️ Which property is set to 20px in this rule?
h2 {
font-size: 20px;
border: 2px solid;
background-color: yellow;
} (a) text-align (b) 20px (c) font-size (d) background-color - 28.📦 In the box model, which part is the gap round content? (a) content (b) margin (c) border (d) padding
-
29.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 270px;
justify-content: space-between;
}
Inside are 2 boxes, each 100px wide (no margins). - 30.🌈 Which hex code is bright green? (a) #ff00ff (b) #00ff00 (c) #00ffff (d) #0000ff
- 31.🌈 In #6b0000 the red part is the hex number 6b. What is it as a normal number?
- 32.🎯 How many elements on a page should have the same id? (a) 5 (b) 1 (c) any number (d) 2
- 33.✍️ In color: blue; which part is the property? (a) : (b) color (c) blue (d) ;
-
34.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 300px;
justify-content: center;
}
Inside are 4 boxes, each 50px wide (no margins). - 35.True or false: .big is an id selector. (a) False (b) True
-
36.✍️ Which property is set to center in this rule?
li {
text-align: center;
color: red;
width: 300px;
} (a) margin (b) center (c) background-color (d) text-align -
37.✍️ What value is given to color in this rule?
body {
border: 2px solid;
padding: 8px;
color: red;
width: 300px;
} (a) color (b) center (c) red (d) 20px -
38.⚖️ What colour is the text of this element?
<h1 class="big" id="hero">Hi</h1>
CSS:
h1 { color: green; }
.big { color: blue; }
#hero { color: red; } (a) green (b) red (c) blue (d) black - 39.🎨 What does CSS stand for? (a) Creative Sheet System (b) Cascading Style Sheets (c) Colourful Site Styles (d) Computer Style Sheets
-
40.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 600px) {
p {
font-size: 18px;
}
}
Answer key
- 70
- h1
- <link>
- puts boxes in the middle
- orange
- Yes
- lays out the page
- True
- yellow
- False
- /*
- Yes
- red
- fits every screen
- <h2 class="menu">
- CSS
- 24
- CSS
- Yes
- sets the letter colour
- 4
- the later one
- margin
- green
- a class selector
- flex-end
- font-size
- padding
- 70
- #00ff00
- 107
- 1
- color
- 50
- False
- text-align
- red
- red
- Cascading Style Sheets
- 16
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids