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 CSS selector matches this element?
<li class="star" id="intro">Hello</li> (a) #main (b) .star (c) #star (d) .intro - 2.🎯 Which sign starts a class selector? (a) & (b) @ (c) # (d) .
- 3.🎯 Which element does the selector p style? (a) <li id="main"> (b) <p class="box"> (c) <h2 class="box"> (d) <h1>
-
4.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 480px) {
p {
font-size: 10px;
}
} (a) No (b) Yes -
5.🎯 Which CSS selector matches this element?
<div class="note" id="top">Hello</div> (a) .note (b) #intro (c) #note (d) span - 6.Which of these does CSS do? (a) puts a picture on a page (b) gives the page structure (c) rounds box corners (d) makes a form box
- 7.🎯 How many elements on a page should have the same id? (a) any number (b) 1 (c) 2 (d) 5
- 8.💪 Which flexbox property sets space between boxes? (a) justify-content (b) align-items (c) gap (d) display: flex
-
9.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 180px;
padding: 20px;
border: 2px solid black;
margin: 15px;
} - 10.🎯 Which element does the selector #intro style? (a) <span class="menu"> (b) <div id="main"> (c) <div class="intro"> (d) <div id="intro">
- 11.🧩 Which language makes headings and lists? (a) HTML (b) JavaScript (c) CSS
- 12.📱 max-width: 600px applies when the screen is ___. (a) turned off (b) exactly 1000px (c) 600px or narrower (d) 600px or wider
- 13.🖌️ Which CSS property sets the letter colour? (a) color (b) font-size (c) text-align (d) font-family
-
14.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 240px;
padding: 10px;
border: 2px solid black;
margin: 5px;
} - 15.🎯 What kind of selector is #main? (a) an id selector (b) a class selector (c) an element selector
-
16.📱 The screen is 1366px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 480px) {
p {
font-size: 14px;
}
} (a) No (b) Yes - 17.🌈 Which colour of light is strongest in rgb(211, 83, 8)? (a) red (b) blue (c) green
-
18.✍️ What value is given to width in this rule?
.box {
color: red;
margin: 10px;
width: 300px;
} (a) width (b) red (c) italic (d) 300px -
19.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 280px;
padding: 20px;
border: 4px solid black;
margin: 10px;
} -
20.✍️ Which property is set to 2px solid in this rule?
.box {
border: 2px solid;
text-align: center;
} (a) 2px solid (b) font-style (c) border (d) width - 21.🔍 Which is the odd one out? (a) makes a form box (b) makes a link (c) makes headings and lists (d) lays out the page
- 22.🌈 What is the biggest number one colour can have in rgb()? (a) 1000 (b) 255 (c) 99 (d) 100
-
23.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 600px) {
p {
font-size: 30px;
}
} -
24.⚖️ What colour is the text of this element?
<h2 class="menu" id="logo">Hi</h2>
CSS:
.menu { color: red; }
h2 { color: orange; }
#logo { color: green; } (a) red (b) orange (c) green (d) blue -
25.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 280px;
padding: 20px;
border: 4px solid black;
margin: 20px;
} - 26.🌈 Which hex code is cyan? (a) #000000 (b) #00ffff (c) #0000ff (d) #ffffff
-
27.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 768px) {
p {
font-size: 14px;
}
} - 28.✍️ Which sign goes between a property and its value? (a) : (b) ; (c) = (d) -
-
29.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 140px;
padding: 20px;
border: 2px solid black;
margin: 15px;
} - 30.True or false: padding is space inside the border. (a) False (b) True
-
31.✍️ Which property is set to 10px in this rule?
.box {
background-color: yellow;
font-style: italic;
margin: 10px;
} (a) font-weight (b) padding (c) 10px (d) margin - 32.🎯 Can many elements share the same class? (a) Yes (b) No
- 33.🎨 Which attribute adds CSS inside one tag? (a) style (b) src (c) href (d) alt
- 34.🎨 What does CSS stand for? (a) Computer Style Sheets (b) Creative Sheet System (c) Colourful Site Styles (d) Cascading Style Sheets
-
35.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 180px;
padding: 25px;
border: 5px solid black;
margin: 20px;
} -
36.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (max-width: 480px) {
p {
font-size: 20px;
}
} -
37.✍️ What is the selector in this CSS rule?
li {
width: 300px;
font-style: italic;
border: 2px solid;
background-color: yellow;
} (a) width (b) li (c) italic (d) body - 38.🎨 Which tag connects an outside CSS file? (a) <a> (b) <css> (c) <img> (d) <link>
- 39.🎯 What kind of selector is .star? (a) a class selector (b) an id selector (c) an element selector
-
40.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (min-width: 480px) {
p {
font-size: 26px;
}
}
Answer key
- .star
- .
- <p class="box">
- Yes
- .note
- rounds box corners
- 1
- gap
- 254
- <div id="intro">
- HTML
- 600px or narrower
- color
- 264
- an id selector
- No
- red
- 300px
- 348
- border
- lays out the page
- 255
- 24
- green
- 368
- #00ffff
- 20
- :
- 214
- True
- margin
- Yes
- style
- Cascading Style Sheets
- 280
- 20
- li
- <link>
- a class selector
- 26
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids