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?
h2 {
font-size: 20px;
width: 300px;
} (a) font-size (b) 300px (c) h2 (d) h1 -
2.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 140px;
justify-content: space-between;
}
Inside are 2 boxes, each 50px wide (no margins). - 3.🎯 What kind of selector is .card? (a) a class selector (b) an element selector (c) an id selector
- 4.🎯 Which element does the selector #top style? (a) <li id="intro"> (b) <div class="red"> (c) <li class="top"> (d) <li id="top">
- 5.🖌️ Which CSS property makes the text bold? (a) color (b) background-color (c) font-family (d) font-weight
- 6.📱 Responsive design means a page ___. (a) has no pictures (b) is only for laptops (c) never changes (d) fits every screen
- 7.Which of these is padding? (a) the gap round content (b) the text or picture (c) the gap to other boxes (d) space outside the border
- 8.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 4 (b) 6 (c) 2 (d) 3
-
9.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 1024px) {
p {
font-size: 12px;
}
} -
10.✍️ What is the selector in this CSS rule?
.box {
padding: 8px;
background-color: yellow;
font-size: 20px;
border: 2px solid;
} (a) yellow (b) padding (c) h2 (d) .box -
11.✍️ How many declarations (property: value pairs) are in this rule?
h2 {
font-weight: bold;
color: red;
} - 12.Which of these does JavaScript do? (a) counts down a timer (b) puts a picture on a page (c) makes headings and lists (d) rounds box corners
- 13.🌈 Which colour of light is strongest in rgb(69, 206, 73)? (a) green (b) red (c) blue
- 14.⚖️ Which selector is the weakest? (a) an element selector (b) a class selector (c) an id selector
- 15.🎯 Which sign starts an id selector? (a) . (b) @ (c) & (d) #
- 16.Which of these does JavaScript do? (a) makes headings and lists (b) sets colours and fonts (c) makes a link (d) shows a pop-up message
- 17.📦 In the box model, which part is the line round the box? (a) margin (b) padding (c) content (d) border
- 18.🎨 Which tag connects an outside CSS file? (a) <a> (b) <link> (c) <css> (d) <img>
- 19.🎯 Which element does the selector #end style? (a) <li class="end"> (b) <div class="menu"> (c) <li id="hero"> (d) <li id="end">
-
20.⚖️ What colour is the text of this element?
<p class="big" id="end">Hi</p>
CSS:
p { color: red; }
p { color: yellow; } (a) purple (b) green (c) red (d) yellow -
21.⚖️ What colour is the text of this element?
<p class="big" id="hero">Hi</p>
CSS:
#hero { color: blue; }
#hero { color: orange; } (a) blue (b) orange (c) purple (d) yellow - 22.What does justify-content: space-between do? (a) packs boxes at the start (b) equal gaps, none at ends (c) puts boxes in the middle (d) packs boxes at the end
- 23.📱 Which tag helps phones show a page at the right size? (a) the title tag (b) the viewport meta tag (c) the br tag (d) the hr tag
- 24.✍️ In color: blue; which part is the property? (a) ; (b) : (c) color (d) blue
- 25.📱 What does a media query check? (a) the page title (b) the battery level (c) the time of day (d) the screen width
- 26.Which of these does JavaScript do? (a) adds space around boxes (b) puts a picture on a page (c) changes the text size (d) checks a quiz answer
- 27.Which of these is margin? (a) the gap round content (b) space outside the border (c) the text or picture (d) a solid or dotted edge
-
28.⚖️ What colour is the text of this element?
<p class="big" id="main">Hi</p>
CSS:
p { color: yellow; }
.big { color: black; }
#main { color: red; } (a) black (b) red (c) yellow (d) green - 29.True or false: img is an element selector. (a) False (b) True
-
30.✍️ What is the selector in this CSS rule?
h1 {
width: 300px;
font-weight: bold;
font-size: 20px;
} (a) p (b) width (c) bold (d) h1 - 31.🎨 What does CSS stand for? (a) Computer Style Sheets (b) Cascading Style Sheets (c) Creative Sheet System (d) Colourful Site Styles
-
32.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 480px) {
p {
font-size: 14px;
}
} - 33.🎯 Which sign starts a class selector? (a) & (b) @ (c) # (d) .
-
34.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 1024px) {
p {
font-size: 24px;
}
} - 35.🌈 Which colour is #00ffff? (a) red (b) cyan (c) yellow (d) magenta
-
36.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 130px;
padding: 20px;
border: 5px solid black;
margin: 0px;
} - 37.🌈 What is the biggest number one colour can have in rgb()? (a) 1000 (b) 99 (c) 100 (d) 255
-
38.📱 The screen is 700px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 600px) {
p {
font-size: 6px;
}
} (a) No (b) Yes -
39.✍️ Which property is set to center in this rule?
h1 {
text-align: center;
font-size: 20px;
} (a) center (b) background-color (c) text-align (d) margin -
40.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (min-width: 480px) {
p {
font-size: 26px;
}
} (a) No (b) Yes
Answer key
- h2
- 40
- a class selector
- <li id="top">
- font-weight
- fits every screen
- the gap round content
- 3
- 16
- .box
- 2
- counts down a timer
- green
- an element selector
- #
- shows a pop-up message
- border
- <link>
- <li id="end">
- yellow
- orange
- equal gaps, none at ends
- the viewport meta tag
- color
- the screen width
- checks a quiz answer
- space outside the border
- red
- True
- h1
- Cascading Style Sheets
- 20
- .
- 16
- cyan
- 180
- 255
- No
- text-align
- No
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids