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 of these is the content? (a) the text or picture (b) space outside the border (c) a solid or dotted edge (d) the gap round content
- 2.🎯 What kind of selector is .card? (a) an id selector (b) a class selector (c) an element selector
-
3.📱 The screen is 414px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (min-width: 1024px) {
p {
font-size: 14px;
}
} (a) Yes (b) No -
4.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 768px) {
p {
font-size: 32px;
}
} - 5.Which of these is the border? (a) the gap round content (b) the gap to other boxes (c) space outside the border (d) the line round the box
-
6.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 290px;
padding: 10px;
border: 5px solid black;
margin: 5px;
} -
7.📱 The screen is 820px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (max-width: 480px) {
p {
font-size: 22px;
}
} (a) No (b) Yes - 8.🎯 Which sign starts an id selector? (a) . (b) @ (c) & (d) #
- 9.📱 max-width: 600px applies when the screen is ___. (a) 600px or narrower (b) turned off (c) 600px or wider (d) exactly 1000px
-
10.✍️ Which property is set to 2px solid in this rule?
p {
border: 2px solid;
background-color: yellow;
} (a) width (b) 2px solid (c) font-style (d) border -
11.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 300px;
justify-content: flex-end;
}
Inside are 3 boxes, each 80px wide (no margins). -
12.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 1024px) {
p {
font-size: 24px;
}
} - 13.🎯 What kind of selector is #hero? (a) a class selector (b) an id selector (c) an element selector
- 14.🎯 What kind of selector is .big? (a) an id selector (b) a class selector (c) an element selector
- 15.True or false: HTML reacts to a button click. (a) True (b) False
- 16.✍️ In color: blue; which part is the value? (a) : (b) ; (c) color (d) blue
-
17.⚖️ What colour is the text of this element?
<p class="red" id="end">Hi</p>
CSS:
.red { color: orange; }
p { color: purple; } (a) orange (b) yellow (c) green (d) purple -
18.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 140px;
padding: 20px;
border: 1px solid black;
margin: 5px;
} - 19.🎯 How many elements on a page should have the same id? (a) any number (b) 2 (c) 5 (d) 1
-
20.✍️ How many declarations (property: value pairs) are in this rule?
h1 {
padding: 8px;
font-weight: bold;
margin: 10px;
} -
21.✍️ Which property is set to 2px solid in this rule?
.note {
font-weight: bold;
border: 2px solid;
} (a) 2px solid (b) width (c) border (d) font-style -
22.✍️ Which property is set to bold in this rule?
h1 {
font-weight: bold;
background-color: yellow;
} (a) width (b) bold (c) border (d) font-weight - 23.True or false: .note is an id selector. (a) False (b) True
-
24.🎯 Which CSS selector matches this element?
<span class="menu" id="top">Hello</span> (a) #intro (b) .menu (c) #menu (d) .top - 25.📱 min-width: 800px applies when the screen is ___. (a) exactly 100px (b) turned off (c) 800px or wider (d) 800px or narrower
- 26.🎯 Which element does the selector .big style? (a) <li class="box"> (b) <h2 class="big"> (c) <h2 id="big"> (d) <h2 class="red">
- 27.📱 Responsive design means a page ___. (a) has no pictures (b) fits every screen (c) never changes (d) is only for laptops
-
28.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 160px;
justify-content: space-between;
}
Inside are 2 boxes, each 40px wide (no margins). - 29.🧩 Which language checks a quiz answer? (a) CSS (b) JavaScript (c) HTML
-
30.⚖️ What colour is the text of this element?
<h2 class="red" id="hero">Hi</h2>
CSS:
h2 { color: purple; }
h2 { color: orange; } (a) purple (b) yellow (c) orange (d) blue - 31.🎨 One CSS file can style how many pages? (a) many pages (b) only one word (c) only one image (d) no pages
-
32.✍️ How many declarations (property: value pairs) are in this rule?
body {
color: red;
margin: 10px;
padding: 8px;
text-align: center;
} - 33.💪 Which flexbox property lines boxes up across? (a) gap (b) align-items (c) flex-direction (d) display: flex
- 34.Which of these does CSS do? (a) changes the page live (b) counts down a timer (c) shows a pop-up message (d) sets colours and fonts
- 35.Which of these does JavaScript do? (a) gives the page structure (b) shows a pop-up message (c) rounds box corners (d) changes the text size
- 36.📱 What does a media query check? (a) the time of day (b) the page title (c) the battery level (d) the screen width
- 37.🎨 Which tag connects an outside CSS file? (a) <css> (b) <a> (c) <img> (d) <link>
- 38.What does color do? (a) makes letters bigger (b) makes the text bold (c) colours behind the text (d) sets the letter colour
-
39.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (max-width: 600px) {
p {
font-size: 18px;
}
} - 40.🧩 Which language puts a picture on a page? (a) HTML (b) JavaScript (c) CSS
Answer key
- the text or picture
- a class selector
- No
- 24
- the line round the box
- 320
- No
- #
- 600px or narrower
- border
- 60
- 16
- an id selector
- a class selector
- False
- blue
- orange
- 192
- 1
- 3
- border
- font-weight
- False
- .menu
- 800px or wider
- <h2 class="big">
- fits every screen
- 80
- JavaScript
- orange
- many pages
- 4
- align-items
- sets colours and fonts
- shows a pop-up message
- the screen width
- <link>
- sets the letter colour
- 24
- HTML
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids