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 starts an id selector? (a) . (b) # (c) @ (d) &
- 2.🎨 What does CSS stand for? (a) Cascading Style Sheets (b) Computer Style Sheets (c) Creative Sheet System (d) Colourful Site Styles
- 3.🌈 Which colour is #0000ff? (a) magenta (b) cyan (c) red (d) blue
-
4.🎯 Which CSS selector matches this element?
<p class="menu" id="intro">Hello</p> (a) .menu (b) .intro (c) #main (d) .note - 5.🧩 Which language makes headings and lists? (a) CSS (b) JavaScript (c) HTML
- 6.📦 In the box model, which part is the gap round content? (a) margin (b) content (c) border (d) padding
-
7.✍️ Which property is set to center in this rule?
li {
width: 300px;
text-align: center;
color: red;
} (a) background-color (b) margin (c) center (d) text-align - 8.📦 In the box model, which part is space outside the border? (a) padding (b) border (c) margin (d) content
- 9.📱 Which tag helps phones show a page at the right size? (a) the hr tag (b) the viewport meta tag (c) the title tag (d) the br tag
- 10.✍️ CSS declarations go inside which brackets? (a) { } (b) ( ) (c) < > (d) [ ]
-
11.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (max-width: 768px) {
p {
font-size: 22px;
}
} -
12.✍️ What value is given to font-size in this rule?
h2 {
margin: 10px;
font-size: 20px;
font-weight: bold;
font-style: italic;
} (a) center (b) 20px (c) yellow (d) font-size -
13.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 70px;
padding: 5px;
border: 2px solid black;
margin: 5px;
} -
14.🖌️ What colour are the letters?
p {
font-size: 32px;
text-align: right;
color: purple;
background-color: red;
} (a) orange (b) purple (c) red -
15.📱 The screen is 1366px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 600px) {
p {
font-size: 10px;
}
} (a) Yes (b) No - 16.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 2 (b) 6 (c) 4 (d) 3
- 17.🖌️ Which CSS property colours behind the text? (a) font-family (b) background-color (c) color (d) font-size
-
18.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 260px;
justify-content: center;
}
Inside are 2 boxes, each 50px wide (no margins). -
19.🖌️ What colour is behind the letters?
li {
color: white;
text-align: left;
background-color: red;
font-size: 32px;
} (a) white (b) blue (c) red -
20.✍️ Which property is set to red in this rule?
h1 {
color: red;
width: 300px;
border: 2px solid;
padding: 8px;
} (a) font-size (b) color (c) red (d) text-align -
21.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 1024px) {
p {
font-size: 14px;
}
} (a) No (b) Yes - 22.🔍 Which is the odd one out? (a) adds space around boxes (b) changes the text size (c) lays out the page (d) changes the page live
- 23.🎯 What kind of selector is #top? (a) a class selector (b) an id selector (c) an element selector
-
24.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (max-width: 768px) {
p {
font-size: 18px;
}
} (a) No (b) Yes -
25.🖌️ Where does the text sit on its line?
li {
background-color: black;
font-size: 24px;
color: green;
text-align: right;
} (a) on the left (b) in the middle (c) on the right - 26.🧩 Which language checks a quiz answer? (a) CSS (b) HTML (c) JavaScript
- 27.✍️ In color: blue; which part is the value? (a) ; (b) : (c) blue (d) color
-
28.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 70px;
padding: 5px;
border: 5px solid black;
margin: 5px;
} -
29.✍️ Which property is set to 2px solid in this rule?
p {
font-size: 20px;
border: 2px solid;
} (a) font-style (b) width (c) border (d) 2px solid -
30.📱 The screen is 540px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 1024px) {
p {
font-size: 30px;
}
} (a) No (b) Yes -
31.✍️ How many declarations (property: value pairs) are in this rule?
li {
border: 2px solid;
color: red;
font-style: italic;
} - 32.True or false: HTML changes the page live. (a) True (b) False
-
33.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 200px;
padding: 10px;
border: 3px solid black;
margin: 10px;
} - 34.Which of these does HTML do? (a) adds space around boxes (b) checks a quiz answer (c) gives the page structure (d) lays out the page
-
35.✍️ What is the selector in this CSS rule?
h2 {
border: 2px solid;
font-weight: bold;
} (a) border (b) bold (c) h1 (d) h2 - 36.True or false: h1 is a class selector. (a) False (b) True
-
37.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 220px;
padding: 25px;
border: 1px solid black;
margin: 0px;
} - 38.True or false: the border is the line round the box. (a) False (b) True
- 39.🌈 Which colour is #00ffff? (a) cyan (b) blue (c) yellow (d) black
-
40.✍️ What value is given to margin in this rule?
p {
font-style: italic;
color: red;
margin: 10px;
width: 300px;
} (a) bold (b) 10px (c) margin (d) 8px
Answer key
- #
- Cascading Style Sheets
- blue
- .menu
- HTML
- padding
- text-align
- margin
- the viewport meta tag
- { }
- 22
- 20px
- 94
- purple
- No
- 3
- background-color
- 80
- red
- color
- Yes
- changes the page live
- an id selector
- Yes
- on the right
- JavaScript
- blue
- 100
- border
- No
- 3
- False
- 246
- gives the page structure
- h2
- False
- 272
- True
- cyan
- 10px
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids