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.📱 Responsive design means a page ___. (a) never changes (b) has no pictures (c) is only for laptops (d) fits every screen
- 2.💪 Which flexbox property picks row or column? (a) flex-direction (b) justify-content (c) gap (d) align-items
-
3.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 80px;
padding: 5px;
border: 1px solid black;
margin: 5px;
} - 4.🔍 Which is the odd one out? (a) gives the page structure (b) reacts to a button click (c) counts down a timer (d) shows a pop-up message
- 5.🎯 Which sign starts a class selector? (a) & (b) @ (c) # (d) .
- 6.🎨 Which tag connects an outside CSS file? (a) <link> (b) <img> (c) <a> (d) <css>
- 7.🌈 Which hex code is yellow? (a) #00ff00 (b) #ffffff (c) #ffff00 (d) #ff0000
- 8.🌈 In #0000f2 the blue part is the hex number f2. What is it as a normal number?
-
9.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 310px;
justify-content: space-between;
}
Inside are 4 boxes, each 40px wide (no margins). - 10.Which of these is padding? (a) a solid or dotted edge (b) the text or picture (c) the line round the box (d) space inside the border
-
11.✍️ How many declarations (property: value pairs) are in this rule?
.note {
text-align: center;
} -
12.✍️ What is the selector in this CSS rule?
body {
font-style: italic;
background-color: yellow;
padding: 8px;
margin: 10px;
} (a) font-style (b) yellow (c) .box (d) body - 13.🎨 One CSS file can style how many pages? (a) no pages (b) many pages (c) only one word (d) only one image
-
14.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (min-width: 1024px) {
p {
font-size: 26px;
}
} - 15.🔍 Which is the odd one out? (a) gives the page structure (b) lays out the page (c) makes headings and lists (d) makes a link
- 16.True or false: CSS adds space around boxes. (a) False (b) True
-
17.🖌️ How big is the text, in px?
p {
color: white;
background-color: green;
text-align: right;
font-size: 20px;
} -
18.⚖️ What colour is the text of this element?
<p class="star" id="end">Hi</p>
CSS:
#end { color: white; }
#end { color: green; } (a) green (b) orange (c) yellow (d) white - 19.⚖️ Which selector is the strongest? (a) an element selector (b) an id selector (c) a class selector
- 20.🔍 Which is the odd one out? (a) shows a pop-up message (b) adds space around boxes (c) lays out the page (d) changes the text size
- 21.🌈 In #rrggbb, which colour do the first two digits give? (a) blue (b) black (c) red (d) green
- 22.✍️ Which sign ends each CSS declaration? (a) ; (b) , (c) . (d) :
- 23.🧩 Which language adds space around boxes? (a) HTML (b) JavaScript (c) CSS
- 24.✍️ In color: blue; which part is the value? (a) color (b) : (c) ; (d) blue
-
25.🎯 Which CSS selector matches this element?
<li class="note" id="logo">Hello</li> (a) li (b) .big (c) #end (d) #note - 26.🌈 In #600000 the red part is the hex number 60. What is it as a normal number?
- 27.True or false: padding is the text or picture. (a) False (b) True
- 28.🌈 Which colour is #00ff00? (a) red (b) yellow (c) bright green (d) white
- 29.🌈 In #5b0000 the red part is the hex number 5b. What is it as a normal number?
- 30.🌈 In #000037 the blue part is the hex number 37. What is it as a normal number?
-
31.⚖️ What colour is the text of this element?
<h1 class="note" id="logo">Hi</h1>
CSS:
.note { color: white; }
h1 { color: black; }
#logo { color: purple; } (a) black (b) purple (c) white (d) green -
32.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 310px;
justify-content: center;
}
Inside are 3 boxes, each 50px wide (no margins). - 33.🌈 Which colour of light is strongest in rgb(32, 2, 167)? (a) green (b) blue (c) red
- 34.🔍 Which is the odd one out? (a) changes the page live (b) reacts to a button click (c) counts down a timer (d) adds space around boxes
- 35.🌈 Which colour is #00ffff? (a) yellow (b) cyan (c) bright green (d) black
-
36.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (min-width: 1024px) {
p {
font-size: 18px;
}
} (a) No (b) Yes - 37.Which of these does CSS do? (a) sets colours and fonts (b) makes a link (c) reacts to a button click (d) gives the page structure
- 38.🌈 Which colour is #000000? (a) yellow (b) magenta (c) black (d) cyan
- 39.✍️ Which sign goes between a property and its value? (a) ; (b) = (c) : (d) -
-
40.🎯 Which CSS selector matches this element?
<h2 class="big" id="end">Hello</h2> (a) h2 (b) li (c) .end (d) .red
Answer key
- fits every screen
- flex-direction
- 102
- gives the page structure
- .
- <link>
- #ffff00
- 242
- 50
- space inside the border
- 1
- body
- many pages
- 26
- lays out the page
- True
- 20
- green
- an id selector
- shows a pop-up message
- red
- ;
- CSS
- blue
- li
- 96
- False
- bright green
- 91
- 55
- purple
- 80
- blue
- adds space around boxes
- cyan
- No
- sets colours and fonts
- black
- :
- h2
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids