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 does font-weight do? (a) colours behind the text (b) makes letters bigger (c) makes the text bold (d) sets the letter colour
-
2.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 60px;
padding: 30px;
border: 1px solid black;
margin: 0px;
} -
3.📱 The screen is 700px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 1024px) {
p {
font-size: 10px;
}
} (a) Yes (b) No - 4.🎯 Which element does the selector #top style? (a) <span class="big"> (b) <div id="intro"> (c) <div class="top"> (d) <div id="top">
-
5.⚖️ What colour is the text of this element?
<h2 class="box" id="logo">Hi</h2>
CSS:
.box { color: blue; }
h2 { color: red; }
#logo { color: black; } (a) blue (b) black (c) white (d) red - 6.🔍 Which is the odd one out? (a) makes a form box (b) changes the page live (c) gives the page structure (d) puts a picture on a page
-
7.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 40px;
padding: 5px;
border: 5px solid black;
margin: 5px;
} - 8.⚖️ Which selector is the strongest? (a) a class selector (b) an id selector (c) an element selector
- 9.🌈 Which colour of light is strongest in rgb(35, 92, 177)? (a) green (b) blue (c) red
-
10.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 180px;
justify-content: flex-end;
}
Inside are 2 boxes, each 50px wide (no margins). - 11.🖌️ Which CSS property colours behind the text? (a) color (b) text-align (c) background-color (d) font-family
- 12.✍️ Which sign ends each CSS declaration? (a) : (b) , (c) ; (d) .
- 13.🌈 Hex digits go 0 to 9, then A to which letter? (a) J (b) F (c) Z (d) G
-
14.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 600px) {
p {
font-size: 22px;
}
} - 15.📱 Which tag helps phones show a page at the right size? (a) the viewport meta tag (b) the title tag (c) the hr tag (d) the br tag
-
16.✍️ Which property is set to red in this rule?
h1 {
font-weight: bold;
color: red;
font-size: 20px;
margin: 10px;
} (a) red (b) font-size (c) color (d) text-align -
17.📱 The screen is 414px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 480px) {
p {
font-size: 26px;
}
} (a) No (b) Yes -
18.⚖️ What colour is the text of this element?
<h2 class="red" id="intro">Hi</h2>
CSS:
#intro { color: purple; }
#intro { color: white; } (a) black (b) white (c) orange (d) purple -
19.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 280px;
padding: 5px;
border: 2px solid black;
margin: 5px;
} - 20.🎨 A CSS file usually ends with which extension? (a) .html (b) .js (c) .css (d) .png
- 21.🌈 Which colour of light is strongest in rgb(61, 69, 209)? (a) green (b) blue (c) red
- 22.True or false: .menu is an element selector. (a) True (b) False
-
23.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 600px) {
p {
font-size: 28px;
}
} - 24.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the later one (c) the first one (d) the shorter one
-
25.✍️ What value is given to background-color in this rule?
body {
background-color: yellow;
text-align: center;
} (a) yellow (b) 8px (c) 10px (d) background-color - 26.🎯 Which element does the selector h2 style? (a) <span id="hero"> (b) <div class="star"> (c) <h2 class="star"> (d) <li>
- 27.Which of these is the border? (a) the text or picture (b) space outside the border (c) space inside the border (d) a solid or dotted edge
-
28.✍️ How many declarations (property: value pairs) are in this rule?
li {
font-size: 20px;
padding: 8px;
margin: 10px;
font-weight: bold;
} -
29.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (min-width: 1024px) {
p {
font-size: 24px;
}
} (a) Yes (b) No -
30.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 250px;
padding: 15px;
border: 3px solid black;
margin: 10px;
} - 31.🎯 How many elements on a page should have the same id? (a) 5 (b) 1 (c) any number (d) 2
- 32.🔍 Which is the odd one out? (a) lays out the page (b) sets colours and fonts (c) rounds box corners (d) puts a picture on a page
- 33.🌈 In #rrggbb, which colour do the last two digits give? (a) red (b) green (c) white (d) blue
-
34.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 60px;
padding: 10px;
border: 3px solid black;
margin: 20px;
} -
35.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 140px;
padding: 25px;
border: 4px solid black;
margin: 10px;
} - 36.Which of these does HTML do? (a) makes a form box (b) sets colours and fonts (c) shows a pop-up message (d) checks a quiz answer
- 37.🧩 Which language gives the page structure? (a) HTML (b) JavaScript (c) CSS
- 38.🖌️ Which CSS property sets the letter colour? (a) font-weight (b) color (c) background-color (d) font-family
- 39.Which of these is margin? (a) the gap to other boxes (b) a solid or dotted edge (c) space inside the border (d) the text or picture
-
40.🖌️ What colour are the letters?
h2 {
font-size: 40px;
background-color: green;
color: yellow;
text-align: right;
} (a) green (b) white (c) yellow
Answer key
- makes the text bold
- 122
- Yes
- <div id="top">
- black
- changes the page live
- 70
- an id selector
- blue
- 80
- background-color
- ;
- F
- 22
- the viewport meta tag
- color
- No
- white
- 304
- .css
- blue
- False
- 28
- the later one
- yellow
- <h2 class="star">
- a solid or dotted edge
- 4
- No
- 306
- 1
- puts a picture on a page
- blue
- 126
- 218
- makes a form box
- HTML
- color
- the gap to other boxes
- yellow
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids