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.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 600px) {
p {
font-size: 10px;
}
} - 2.Which of these does JavaScript do? (a) changes the page live (b) makes a form box (c) makes headings and lists (d) puts a picture on a page
- 3.💪 Which flexbox property turns on flexbox? (a) justify-content (b) display: flex (c) align-items (d) flex-direction
- 4.📦 In the box model, which part is the text or picture? (a) border (b) padding (c) margin (d) content
- 5.✍️ CSS declarations go inside which brackets? (a) < > (b) ( ) (c) [ ] (d) { }
- 6.Which of these is the content? (a) space outside the border (b) the text or picture (c) a solid or dotted edge (d) the gap to other boxes
- 7.📦 In the box model, which part is the gap to other boxes? (a) border (b) margin (c) padding (d) content
- 8.True or false: the content is space inside the border. (a) False (b) True
-
9.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 70px;
padding: 25px;
border: 3px solid black;
margin: 5px;
} - 10.✍️ How does a CSS comment start? (a) <!-- (b) // (c) /* (d) #
- 11.💪 Which flexbox property spaces boxes along a row? (a) flex-direction (b) justify-content (c) align-items (d) display: flex
- 12.True or false: CSS changes the text size. (a) True (b) False
-
13.✍️ How many declarations (property: value pairs) are in this rule?
h2 {
color: red;
font-size: 20px;
width: 300px;
} - 14.🎨 What does CSS stand for? (a) Creative Sheet System (b) Colourful Site Styles (c) Cascading Style Sheets (d) Computer Style Sheets
- 15.📱 max-width: 600px applies when the screen is ___. (a) 600px or narrower (b) turned off (c) exactly 1000px (d) 600px or wider
-
16.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 768px) {
p {
font-size: 18px;
}
} - 17.True or false: HTML makes headings and lists. (a) True (b) False
-
18.✍️ What is the selector in this CSS rule?
#top {
color: red;
margin: 10px;
} (a) #top (b) color (c) li (d) 10px -
19.🖌️ How big is the text, in px?
h2 {
background-color: yellow;
color: blue;
text-align: left;
font-size: 28px;
} -
20.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 1024px) {
p {
font-size: 32px;
}
} - 21.🎨 Which tag holds CSS inside the head? (a) <script> (b) <body> (c) <css> (d) <style>
- 22.🌈 Which colour is #ffffff? (a) red (b) yellow (c) white (d) cyan
- 23.🌈 Which hex code is bright green? (a) #ff00ff (b) #0000ff (c) #00ff00 (d) #000000
-
24.⚖️ What colour is the text of this element?
<p class="menu" id="main">Hi</p>
CSS:
p { color: green; }
p { color: purple; } (a) green (b) red (c) orange (d) purple -
25.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 150px;
padding: 20px;
border: 3px solid black;
margin: 15px;
} -
26.✍️ How many declarations (property: value pairs) are in this rule?
#top {
padding: 8px;
width: 300px;
background-color: yellow;
color: red;
} -
27.🖌️ What colour is behind the letters?
h1 {
text-align: right;
background-color: black;
color: red;
font-size: 20px;
} (a) red (b) black (c) orange - 28.📱 Responsive design means a page ___. (a) has no pictures (b) is only for laptops (c) never changes (d) fits every screen
-
29.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 310px;
justify-content: center;
}
Inside are 3 boxes, each 50px wide (no margins). - 30.🎯 What kind of selector is .star? (a) an id selector (b) a class selector (c) an element selector
- 31.🧩 Which language sets colours and fonts? (a) JavaScript (b) HTML (c) CSS
-
32.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (min-width: 1024px) {
p {
font-size: 20px;
}
} (a) No (b) Yes -
33.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 260px;
justify-content: flex-start;
}
Inside are 4 boxes, each 50px wide (no margins). -
34.✍️ How many declarations (property: value pairs) are in this rule?
h2 {
border: 2px solid;
} - 35.🎯 Which element does the selector p style? (a) <p class="big"> (b) <h1> (c) <h2 class="big"> (d) <li id="hero">
- 36.🧩 Which language makes headings and lists? (a) HTML (b) CSS (c) JavaScript
- 37.🔍 Which is the odd one out? (a) makes a form box (b) rounds box corners (c) makes headings and lists (d) makes a link
- 38.⚖️ Which selector is the strongest? (a) a class selector (b) an element selector (c) an id selector
-
39.✍️ How many declarations (property: value pairs) are in this rule?
.note {
background-color: yellow;
} -
40.🖌️ Where does the text sit on its line?
h2 {
text-align: left;
background-color: yellow;
font-size: 12px;
color: green;
} (a) in the middle (b) on the left (c) on the right
Answer key
- 10
- changes the page live
- display: flex
- content
- { }
- the text or picture
- margin
- False
- 136
- /*
- justify-content
- True
- 3
- Cascading Style Sheets
- 600px or narrower
- 18
- True
- #top
- 28
- 24
- <style>
- white
- #00ff00
- purple
- 196
- 4
- black
- fits every screen
- 80
- a class selector
- CSS
- No
- 60
- 1
- <p class="big">
- HTML
- rounds box corners
- an id selector
- 1
- on the left
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids