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 colour of light is strongest in rgb(101, 210, 62)? (a) blue (b) red (c) green
-
2.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 230px;
padding: 20px;
border: 5px solid black;
margin: 20px;
} - 3.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) neither (c) the first one (d) the later one
-
4.⚖️ What colour is the text of this element?
<p class="big" id="top">Hi</p>
CSS:
p { color: white; }
p { color: black; } (a) white (b) blue (c) black (d) red - 5.📱 max-width: 600px applies when the screen is ___. (a) exactly 1000px (b) turned off (c) 600px or wider (d) 600px or narrower
-
6.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 90px;
padding: 30px;
border: 5px solid black;
margin: 10px;
} -
7.✍️ Which property is set to 20px in this rule?
.box {
font-style: italic;
font-size: 20px;
width: 300px;
} (a) text-align (b) background-color (c) font-size (d) 20px - 8.🌈 In #000022 the blue part is the hex number 22. What is it as a normal number?
- 9.🌈 What is the biggest number one colour can have in rgb()? (a) 255 (b) 99 (c) 100 (d) 1000
- 10.💪 Which flexbox property turns on flexbox? (a) gap (b) justify-content (c) align-items (d) display: flex
-
11.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 610px;
justify-content: space-between;
}
Inside are 4 boxes, each 100px wide (no margins). - 12.📱 What does a media query check? (a) the screen width (b) the battery level (c) the page title (d) the time of day
- 13.💪 Which justify-content value puts boxes in the middle? (a) space-between (b) flex-start (c) flex-end (d) center
- 14.🔍 Which is the odd one out? (a) rounds box corners (b) makes a form box (c) puts a picture on a page (d) makes a link
- 15.💪 Which flexbox property picks row or column? (a) display: flex (b) align-items (c) justify-content (d) flex-direction
- 16.True or false: padding is the gap round content. (a) True (b) False
- 17.🌈 Which colour is #000000? (a) blue (b) bright green (c) yellow (d) black
- 18.True or false: JavaScript makes headings and lists. (a) False (b) True
- 19.🧩 Which language gives the page structure? (a) HTML (b) CSS (c) JavaScript
- 20.What does color do? (a) sets the letter colour (b) makes letters bigger (c) centres a heading (d) colours behind the text
- 21.⚖️ Which selector is the strongest? (a) a class selector (b) an element selector (c) an id selector
- 22.🔍 Which is the odd one out? (a) makes a link (b) shows a pop-up message (c) checks a quiz answer (d) reacts to a button click
- 23.🌈 In #rrggbb, which colour do the first two digits give? (a) green (b) blue (c) red (d) black
- 24.🎯 Which element does the selector li style? (a) <div> (b) <p id="intro"> (c) <li class="red"> (d) <span class="red">
- 25.🌈 In #500000 the red part is the hex number 50. What is it as a normal number?
- 26.🎯 Which element does the selector div style? (a) <p class="note"> (b) <h1 id="logo"> (c) <span> (d) <div class="note">
-
27.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 440px;
justify-content: center;
}
Inside are 4 boxes, each 100px wide (no margins). - 28.True or false: padding is space outside the border. (a) True (b) False
-
29.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 1024px) {
p {
font-size: 6px;
}
} - 30.True or false: the border is space inside the border. (a) False (b) True
- 31.Which of these does HTML do? (a) reacts to a button click (b) checks a quiz answer (c) makes headings and lists (d) shows a pop-up message
- 32.✍️ In color: blue; which part is the property? (a) ; (b) blue (c) : (d) color
- 33.🌈 In #rrggbb, which colour do the last two digits give? (a) red (b) white (c) green (d) blue
- 34.True or false: .note is a class selector. (a) True (b) False
- 35.🎨 Which tag connects an outside CSS file? (a) <link> (b) <a> (c) <img> (d) <css>
-
36.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (min-width: 480px) {
p {
font-size: 28px;
}
} (a) Yes (b) No -
37.✍️ Which property is set to 20px in this rule?
.box {
text-align: center;
font-size: 20px;
color: red;
} (a) text-align (b) background-color (c) 20px (d) font-size - 38.🎯 Which element does the selector .box style? (a) <div id="box"> (b) <span class="menu"> (c) <div class="star"> (d) <div class="box">
- 39.🧩 Which language lays out the page? (a) HTML (b) CSS (c) JavaScript
-
40.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 210px;
padding: 5px;
border: 5px solid black;
margin: 0px;
}
Answer key
- green
- 320
- the later one
- black
- 600px or narrower
- 180
- font-size
- 34
- 255
- display: flex
- 70
- the screen width
- center
- rounds box corners
- flex-direction
- True
- black
- False
- HTML
- sets the letter colour
- an id selector
- makes a link
- red
- <li class="red">
- 80
- <div class="note">
- 20
- False
- 6
- False
- makes headings and lists
- color
- blue
- True
- <link>
- No
- font-size
- <div class="box">
- CSS
- 230
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids