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 is rgb(255, 255, 255)? (a) cyan (b) yellow (c) white (d) red
- 2.🧩 Which language makes headings and lists? (a) CSS (b) JavaScript (c) HTML
- 3.What does justify-content: flex-start do? (a) packs boxes at the end (b) puts boxes in the middle (c) packs boxes at the start (d) equal gaps, none at ends
- 4.True or false: the border is the line round the box. (a) True (b) False
-
5.🖌️ What colour are the letters?
h1 {
text-align: left;
background-color: white;
font-size: 40px;
color: blue;
} (a) white (b) black (c) blue -
6.⚖️ What colour is the text of this element?
<h1 class="big" id="hero">Hi</h1>
CSS:
.big { color: green; }
h1 { color: white; } (a) green (b) white (c) black (d) orange - 7.🔍 Which is the odd one out? (a) makes headings and lists (b) adds space around boxes (c) makes a form box (d) makes a link
-
8.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 130px;
padding: 20px;
border: 3px solid black;
margin: 5px;
} - 9.True or false: #hero is an element selector. (a) True (b) False
- 10.✍️ In color: blue; which part is the value? (a) blue (b) color (c) ; (d) :
-
11.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 160px;
justify-content: flex-start;
}
Inside are 3 boxes, each 40px wide (no margins). -
12.🖌️ How big is the text, in px?
li {
background-color: purple;
text-align: left;
color: orange;
font-size: 32px;
} -
13.📱 The screen is 700px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 480px) {
p {
font-size: 26px;
}
} (a) No (b) Yes - 14.🎯 Which element does the selector li style? (a) <span class="menu"> (b) <li class="menu"> (c) <p id="top"> (d) <div>
- 15.🌈 In #640000 the red part is the hex number 64. What is it as a normal number?
- 16.True or false: .card is an id selector. (a) True (b) False
-
17.📱 The screen is 1366px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (min-width: 600px) {
p {
font-size: 20px;
}
} (a) No (b) Yes -
18.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 480px) {
p {
font-size: 18px;
}
} -
19.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 480px) {
p {
font-size: 16px;
}
} -
20.✍️ What value is given to padding in this rule?
li {
text-align: center;
color: red;
border: 2px solid;
padding: 8px;
} (a) bold (b) 2px solid (c) padding (d) 8px -
21.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 600px) {
p {
font-size: 10px;
}
} - 22.✍️ In color: blue; which part is the property? (a) blue (b) : (c) color (d) ;
-
23.⚖️ What colour is the text of this element?
<h2 class="star" id="logo">Hi</h2>
CSS:
h2 { color: blue; }
h2 { color: purple; } (a) blue (b) purple (c) orange (d) yellow - 24.🎯 Which element does the selector #intro style? (a) <div id="main"> (b) <div class="intro"> (c) <span class="menu"> (d) <div id="intro">
-
25.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 350px;
justify-content: flex-start;
}
Inside are 3 boxes, each 100px wide (no margins). -
26.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 50px;
padding: 15px;
border: 3px solid black;
margin: 15px;
} - 27.🎨 Which attribute adds CSS inside one tag? (a) alt (b) style (c) href (d) src
- 28.💪 Which flexbox property picks row or column? (a) gap (b) display: flex (c) justify-content (d) flex-direction
- 29.📱 What does a media query check? (a) the battery level (b) the screen width (c) the page title (d) the time of day
- 30.📱 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
- 31.True or false: HTML sets colours and fonts. (a) False (b) True
- 32.✍️ Which sign ends each CSS declaration? (a) ; (b) , (c) . (d) :
-
33.⚖️ What colour is the text of this element?
<h2 class="note" id="logo">Hi</h2>
CSS:
#logo { color: white; }
h2 { color: green; } (a) black (b) green (c) purple (d) white - 34.🧩 Which language rounds box corners? (a) CSS (b) JavaScript (c) HTML
- 35.🎨 Which tag connects an outside CSS file? (a) <img> (b) <a> (c) <css> (d) <link>
- 36.🌈 Which colour is #00ffff? (a) red (b) cyan (c) magenta (d) yellow
- 37.Which of these does JavaScript do? (a) puts a picture on a page (b) changes the page live (c) sets colours and fonts (d) lays out the page
- 38.🌈 Hex digits go 0 to 9, then A to which letter? (a) Z (b) F (c) J (d) G
- 39.🎯 Which element does the selector .menu style? (a) <h2 class="big"> (b) <h1 class="menu"> (c) <h1 id="menu"> (d) <h1 class="note">
-
40.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 240px;
justify-content: flex-end;
}
Inside are 4 boxes, each 50px wide (no margins).
Answer key
- white
- HTML
- packs boxes at the start
- True
- blue
- green
- adds space around boxes
- 186
- False
- blue
- 40
- 32
- Yes
- <li class="menu">
- 100
- False
- Yes
- 20
- 16
- 8px
- 10
- color
- purple
- <div id="intro">
- 50
- 116
- style
- flex-direction
- the screen width
- the viewport meta tag
- False
- ;
- white
- CSS
- <link>
- cyan
- changes the page live
- F
- <h1 class="menu">
- 40
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids