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 sign goes between a property and its value? (a) - (b) ; (c) = (d) :
-
2.✍️ Which property is set to center in this rule?
h1 {
font-weight: bold;
margin: 10px;
text-align: center;
} (a) margin (b) text-align (c) background-color (d) center -
3.🖌️ Where does the text sit on its line?
p {
background-color: purple;
color: white;
text-align: right;
font-size: 40px;
} (a) in the middle (b) on the left (c) on the right - 4.🖌️ Which CSS property sets the letter colour? (a) background-color (b) font-weight (c) text-align (d) color
- 5.🌈 In #2f0000 the red part is the hex number 2f. What is it as a normal number?
- 6.✍️ In color: blue; which part is the value? (a) : (b) color (c) ; (d) blue
- 7.🧩 Which language gives the page structure? (a) JavaScript (b) CSS (c) HTML
-
8.✍️ What value is given to text-align in this rule?
.box {
background-color: yellow;
text-align: center;
border: 2px solid;
} (a) text-align (b) yellow (c) center (d) 10px - 9.True or false: #hero is an id selector. (a) False (b) True
-
10.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 300px;
padding: 10px;
border: 3px solid black;
margin: 20px;
} -
11.✍️ What value is given to color in this rule?
h1 {
font-weight: bold;
font-size: 20px;
color: red;
} (a) center (b) color (c) red (d) 20px -
12.✍️ What is the selector in this CSS rule?
body {
padding: 8px;
border: 2px solid;
} (a) body (b) 2px solid (c) padding (d) .box - 13.🧩 Which language makes a link? (a) JavaScript (b) CSS (c) HTML
- 14.Which of these does CSS do? (a) changes the text size (b) makes a link (c) checks a quiz answer (d) gives the page structure
- 15.🧩 Which language checks a quiz answer? (a) CSS (b) HTML (c) JavaScript
- 16.True or false: JavaScript puts a picture on a page. (a) False (b) True
- 17.🌈 Which hex code is blue? (a) #000000 (b) #00ff00 (c) #ff00ff (d) #0000ff
- 18.📱 What does a media query check? (a) the page title (b) the battery level (c) the time of day (d) the screen width
-
19.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 90px;
padding: 30px;
border: 1px solid black;
margin: 5px;
} - 20.🌈 Which hex code is magenta? (a) #ff0000 (b) #00ff00 (c) #ffffff (d) #ff00ff
-
21.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 400px;
justify-content: flex-end;
}
Inside are 4 boxes, each 80px wide (no margins). - 22.True or false: the content is a solid or dotted edge. (a) True (b) False
-
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: 290px;
padding: 5px;
border: 5px solid black;
margin: 20px;
} -
24.📱 The screen is 1100px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 600px) {
p {
font-size: 8px;
}
} (a) No (b) Yes -
25.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 600px) {
p {
font-size: 30px;
}
} - 26.💪 Which flexbox property sets space between boxes? (a) flex-direction (b) gap (c) align-items (d) display: flex
-
27.✍️ What value is given to text-align in this rule?
p {
color: red;
background-color: yellow;
text-align: center;
} (a) text-align (b) center (c) 10px (d) yellow -
28.🖌️ How big is the text, in px?
li {
background-color: black;
color: purple;
font-size: 28px;
text-align: left;
} - 29.🌈 Which colour of light is strongest in rgb(123, 71, 202)? (a) red (b) blue (c) green
-
30.✍️ What is the selector in this CSS rule?
.box {
background-color: yellow;
font-size: 20px;
} (a) h2 (b) 20px (c) background-color (d) .box -
31.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 280px;
justify-content: center;
}
Inside are 4 boxes, each 60px wide (no margins). -
32.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (min-width: 480px) {
p {
font-size: 20px;
}
} - 33.🌈 Which colour of light is strongest in rgb(249, 70, 68)? (a) blue (b) green (c) red
- 34.🔍 Which is the odd one out? (a) counts down a timer (b) changes the text size (c) sets colours and fonts (d) adds space around boxes
-
35.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 90px;
padding: 10px;
border: 1px solid black;
margin: 5px;
} - 36.Which of these does HTML do? (a) gives the page structure (b) changes the text size (c) checks a quiz answer (d) rounds box corners
- 37.True or false: HTML makes a link. (a) True (b) False
- 38.🖌️ Which CSS property picks the font style? (a) color (b) background-color (c) font-weight (d) font-family
- 39.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 2 (b) 3 (c) 6 (d) 4
-
40.✍️ What value is given to color in this rule?
.box {
margin: 10px;
color: red;
} (a) center (b) color (c) red (d) 20px
Answer key
- :
- text-align
- on the right
- color
- 47
- blue
- HTML
- center
- True
- 366
- red
- body
- HTML
- changes the text size
- JavaScript
- False
- #0000ff
- the screen width
- 152
- #ff00ff
- 80
- False
- 310
- No
- 24
- gap
- center
- 28
- blue
- .box
- 20
- 20
- red
- counts down a timer
- 122
- gives the page structure
- True
- font-family
- 3
- red
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids