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 colour is the text of this element?
<h1 class="note" id="top">Hi</h1>
CSS:
#top { color: red; }
.note { color: black; }
h1 { color: yellow; } (a) black (b) red (c) yellow (d) orange -
2.✍️ What value is given to margin in this rule?
h1 {
padding: 8px;
margin: 10px;
font-size: 20px;
} (a) bold (b) margin (c) 8px (d) 10px -
3.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 50px;
padding: 20px;
border: 4px solid black;
margin: 5px;
} -
4.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 768px) {
p {
font-size: 32px;
}
} - 5.🌈 Which colour is rgb(0, 0, 255)? (a) red (b) bright green (c) blue (d) cyan
-
6.🖌️ Where does the text sit on its line?
li {
font-size: 32px;
text-align: center;
color: blue;
background-color: red;
} (a) in the middle (b) on the right (c) on the left - 7.What does text-align do? (a) centres a heading (b) colours behind the text (c) picks the font style (d) makes the text bold
- 8.✍️ CSS declarations go inside which brackets? (a) { } (b) [ ] (c) < > (d) ( )
-
9.📱 The screen is 414px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (min-width: 600px) {
p {
font-size: 28px;
}
} (a) No (b) Yes - 10.🧩 Which language counts down a timer? (a) HTML (b) CSS (c) JavaScript
-
11.📱 The screen is 1366px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (min-width: 480px) {
p {
font-size: 18px;
}
} (a) No (b) Yes -
12.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 320px;
justify-content: center;
}
Inside are 2 boxes, each 100px wide (no margins). - 13.🎨 What does CSS stand for? (a) Cascading Style Sheets (b) Creative Sheet System (c) Colourful Site Styles (d) Computer Style Sheets
-
14.📱 The screen is 414px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (max-width: 600px) {
p {
font-size: 16px;
}
} (a) No (b) Yes - 15.📱 Responsive design means a page ___. (a) never changes (b) fits every screen (c) is only for laptops (d) has no pictures
- 16.🌈 Which colour is #00ff00? (a) bright green (b) yellow (c) blue (d) cyan
- 17.🌈 Which hex code is red? (a) #ffff00 (b) #0000ff (c) #00ff00 (d) #ff0000
- 18.🎨 One CSS file can style how many pages? (a) only one image (b) many pages (c) only one word (d) no pages
- 19.⚖️ Which selector is the strongest? (a) a class selector (b) an element selector (c) an id selector
- 20.🌈 Which colour is #000000? (a) bright green (b) cyan (c) blue (d) black
- 21.True or false: body is a class selector. (a) False (b) True
- 22.✍️ In color: blue; which part is the value? (a) color (b) ; (c) blue (d) :
- 23.🧩 Which language reacts to a button click? (a) HTML (b) CSS (c) JavaScript
- 24.🌈 In #960000 the red part is the hex number 96. What is it as a normal number?
- 25.💪 Which justify-content value equal gaps, none at ends? (a) flex-end (b) center (c) space-between (d) flex-start
- 26.🌈 What is the biggest number one colour can have in rgb()? (a) 1000 (b) 99 (c) 255 (d) 100
-
27.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 200px;
justify-content: center;
}
Inside are 2 boxes, each 40px wide (no margins). - 28.What does font-weight do? (a) makes letters bigger (b) colours behind the text (c) makes the text bold (d) sets the letter colour
- 29.True or false: JavaScript sets colours and fonts. (a) True (b) False
-
30.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 600px) {
p {
font-size: 32px;
}
} - 31.🖌️ Which CSS property picks the font style? (a) color (b) font-weight (c) background-color (d) font-family
- 32.🖌️ Which CSS property colours behind the text? (a) background-color (b) font-family (c) font-weight (d) color
-
33.✍️ How many declarations (property: value pairs) are in this rule?
#top {
width: 300px;
margin: 10px;
font-style: italic;
} - 34.🎯 What kind of selector is .menu? (a) an id selector (b) an element selector (c) a class selector
- 35.✍️ Which sign goes between a property and its value? (a) = (b) ; (c) - (d) :
- 36.🌈 Which colour is rgb(0, 255, 0)? (a) yellow (b) black (c) bright green (d) blue
-
37.🖌️ What colour is behind the letters?
li {
text-align: left;
background-color: red;
font-size: 40px;
color: orange;
} (a) red (b) white (c) orange - 38.Which of these does JavaScript do? (a) changes the text size (b) makes a link (c) sets colours and fonts (d) shows a pop-up message
-
39.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 300px;
padding: 30px;
border: 3px solid black;
margin: 0px;
} -
40.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 130px;
padding: 10px;
border: 3px solid black;
margin: 15px;
}
Answer key
- red
- 10px
- 108
- 24
- blue
- in the middle
- centres a heading
- { }
- No
- JavaScript
- Yes
- 60
- Cascading Style Sheets
- Yes
- fits every screen
- bright green
- #ff0000
- many pages
- an id selector
- black
- False
- blue
- JavaScript
- 150
- space-between
- 255
- 60
- makes the text bold
- False
- 32
- font-family
- background-color
- 3
- a class selector
- :
- bright green
- red
- shows a pop-up message
- 366
- 156
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids