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.🌈 In #dc0000 the red part is the hex number dc. What is it as a normal number?
-
2.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 480px) {
p {
font-size: 10px;
}
} - 3.📱 Responsive design means a page ___. (a) is only for laptops (b) never changes (c) fits every screen (d) has no pictures
-
4.✍️ How many declarations (property: value pairs) are in this rule?
#top {
border: 2px solid;
} -
5.✍️ Which property is set to 20px in this rule?
p {
text-align: center;
background-color: yellow;
font-size: 20px;
color: red;
} (a) 20px (b) text-align (c) background-color (d) font-size - 6.What does font-weight do? (a) centres a heading (b) makes the text bold (c) picks the font style (d) makes letters bigger
- 7.📱 What does a media query check? (a) the page title (b) the time of day (c) the screen width (d) the battery level
- 8.🎯 Which element does the selector .box style? (a) <span id="box"> (b) <p class="menu"> (c) <span class="box"> (d) <span class="star">
-
9.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (min-width: 768px) {
p {
font-size: 20px;
}
} - 10.True or false: margin is space inside the border. (a) False (b) True
-
11.🖌️ What colour are the letters?
h1 {
font-size: 28px;
text-align: left;
color: green;
background-color: white;
} (a) white (b) orange (c) green - 12.Which of these is margin? (a) space inside the border (b) the line round the box (c) a solid or dotted edge (d) the gap to other boxes
-
13.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 240px;
justify-content: center;
}
Inside are 2 boxes, each 40px wide (no margins). - 14.✍️ Which sign ends each CSS declaration? (a) ; (b) : (c) . (d) ,
- 15.🌈 Which colour is #ff0000? (a) bright green (b) white (c) red (d) magenta
-
16.✍️ What is the selector in this CSS rule?
body {
font-style: italic;
text-align: center;
color: red;
border: 2px solid;
} (a) center (b) font-style (c) .box (d) body - 17.📦 In the box model, which part is the text or picture? (a) padding (b) border (c) content (d) margin
- 18.💪 Which justify-content value puts boxes in the middle? (a) flex-start (b) center (c) space-between (d) flex-end
- 19.🎯 What kind of selector is li? (a) an element selector (b) a class selector (c) an id selector
- 20.📦 In the box model, which part is space inside the border? (a) border (b) padding (c) content (d) margin
-
21.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 100px;
padding: 15px;
border: 1px solid black;
margin: 0px;
} - 22.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the first one (b) neither (c) the shorter one (d) the later one
-
23.🖌️ Where does the text sit on its line?
li {
color: black;
text-align: left;
background-color: blue;
font-size: 12px;
} (a) on the left (b) in the middle (c) on the right - 24.🌈 Which colour is #ffff00? (a) red (b) magenta (c) blue (d) yellow
-
25.🎯 Which CSS selector matches this element?
<li class="big" id="main">Hello</li> (a) .red (b) #big (c) .main (d) #main - 26.🖌️ Which CSS property sets the letter colour? (a) font-weight (b) text-align (c) color (d) font-family
-
27.✍️ How many declarations (property: value pairs) are in this rule?
.note {
font-size: 20px;
font-style: italic;
text-align: center;
color: red;
} - 28.Which of these does HTML do? (a) shows a pop-up message (b) reacts to a button click (c) changes the text size (d) puts a picture on a page
-
29.📱 The screen is 700px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (min-width: 1024px) {
p {
font-size: 20px;
}
} (a) Yes (b) No - 30.True or false: CSS gives the page structure. (a) False (b) True
-
31.🎯 Which CSS selector matches this element?
<div class="note" id="top">Hello</div> (a) #note (b) span (c) .top (d) div - 32.🌈 Which colour is #0000ff? (a) cyan (b) blue (c) magenta (d) black
-
33.✍️ What value is given to padding in this rule?
body {
font-style: italic;
color: red;
padding: 8px;
font-weight: bold;
} (a) 8px (b) padding (c) 2px solid (d) bold - 34.Which of these does CSS do? (a) lays out the page (b) changes the page live (c) checks a quiz answer (d) gives the page structure
- 35.🎨 What does CSS stand for? (a) Computer Style Sheets (b) Creative Sheet System (c) Colourful Site Styles (d) Cascading Style Sheets
- 36.🎯 Which element does the selector #end style? (a) <li id="end"> (b) <li id="hero"> (c) <div class="red"> (d) <li class="end">
-
37.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 280px;
justify-content: space-between;
}
Inside are 3 boxes, each 40px wide (no margins). - 38.🔍 Which is the odd one out? (a) gives the page structure (b) adds space around boxes (c) puts a picture on a page (d) makes a link
- 39.📱 Which tag helps phones show a page at the right size? (a) the br tag (b) the viewport meta tag (c) the hr tag (d) the title tag
-
40.📱 The screen is 540px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (min-width: 768px) {
p {
font-size: 24px;
}
} (a) No (b) Yes
Answer key
- 220
- 10
- fits every screen
- 1
- font-size
- makes the text bold
- the screen width
- <span class="box">
- 12
- False
- green
- the gap to other boxes
- 80
- ;
- red
- body
- content
- center
- an element selector
- padding
- 132
- the later one
- on the left
- yellow
- #main
- color
- 4
- puts a picture on a page
- No
- False
- div
- blue
- 8px
- lays out the page
- Cascading Style Sheets
- <li id="end">
- 80
- adds space around boxes
- the viewport meta tag
- No
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids