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-family do? (a) makes letters bigger (b) makes the text bold (c) sets the letter colour (d) picks the font style
- 2.🎨 One CSS file can style how many pages? (a) only one word (b) only one image (c) no pages (d) many pages
- 3.Which of these is the content? (a) the text or picture (b) the gap to other boxes (c) space inside the border (d) the line round the box
-
4.⚖️ What colour is the text of this element?
<h1 class="big" id="top">Hi</h1>
CSS:
h1 { color: yellow; }
h1 { color: red; } (a) red (b) green (c) yellow (d) white - 5.💪 Which flexbox property lines boxes up across? (a) align-items (b) display: flex (c) gap (d) flex-direction
-
6.📱 The screen is 1100px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (max-width: 768px) {
p {
font-size: 18px;
}
} (a) No (b) Yes -
7.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 300px;
padding: 30px;
border: 1px solid black;
margin: 20px;
} -
8.✍️ What value is given to width in this rule?
h1 {
font-size: 20px;
width: 300px;
font-weight: bold;
padding: 8px;
} (a) 300px (b) width (c) italic (d) red - 9.🖌️ Which CSS property makes the text bold? (a) background-color (b) font-family (c) color (d) font-weight
- 10.🖌️ Which CSS property centres a heading? (a) color (b) text-align (c) font-weight (d) font-family
- 11.📱 Which tag helps phones show a page at the right size? (a) the title tag (b) the hr tag (c) the br tag (d) the viewport meta tag
-
12.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 180px;
padding: 20px;
border: 2px solid black;
margin: 0px;
} - 13.🎯 Can many elements share the same class? (a) Yes (b) No
- 14.✍️ How does a CSS comment start? (a) # (b) /* (c) // (d) <!--
- 15.📱 What does a media query check? (a) the page title (b) the time of day (c) the screen width (d) the battery level
-
16.✍️ What is the selector in this CSS rule?
p {
width: 300px;
border: 2px solid;
margin: 10px;
text-align: center;
} (a) .note (b) 2px solid (c) p (d) width - 17.True or false: the content is the text or picture. (a) False (b) True
- 18.🔍 Which is the odd one out? (a) adds space around boxes (b) counts down a timer (c) reacts to a button click (d) shows a pop-up message
- 19.Which of these does JavaScript do? (a) puts a picture on a page (b) makes a link (c) changes the page live (d) makes a form box
- 20.🎨 What does CSS stand for? (a) Computer Style Sheets (b) Creative Sheet System (c) Cascading Style Sheets (d) Colourful Site Styles
-
21.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (max-width: 480px) {
p {
font-size: 20px;
}
} (a) Yes (b) No -
22.⚖️ What colour is the text of this element?
<h2 class="menu" id="intro">Hi</h2>
CSS:
#intro { color: green; }
h2 { color: orange; }
.menu { color: blue; } (a) blue (b) green (c) orange (d) white -
23.⚖️ What colour is the text of this element?
<h1 class="menu" id="end">Hi</h1>
CSS:
.menu { color: blue; }
h1 { color: yellow; }
#end { color: red; } (a) green (b) yellow (c) red (d) blue -
24.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 768px) {
p {
font-size: 12px;
}
} - 25.🔍 Which is the odd one out? (a) changes the page live (b) checks a quiz answer (c) counts down a timer (d) makes a link
- 26.What does justify-content: space-between do? (a) packs boxes at the start (b) equal gaps, none at ends (c) puts boxes in the middle (d) packs boxes at the end
-
27.⚖️ What colour is the text of this element?
<h1 class="box" id="top">Hi</h1>
CSS:
#top { color: purple; }
#top { color: orange; } (a) purple (b) orange (c) blue (d) yellow - 28.✍️ Which sign goes between a property and its value? (a) = (b) ; (c) - (d) :
- 29.💪 Which flexbox property picks row or column? (a) flex-direction (b) align-items (c) gap (d) display: flex
- 30.🎨 Which tag holds CSS inside the head? (a) <style> (b) <script> (c) <css> (d) <body>
-
31.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 140px;
justify-content: center;
}
Inside are 2 boxes, each 60px wide (no margins). -
32.✍️ Which property is set to 300px in this rule?
.box {
width: 300px;
background-color: yellow;
} (a) font-style (b) width (c) color (d) 300px -
33.✍️ Which property is set to italic in this rule?
#top {
font-style: italic;
width: 300px;
} (a) font-size (b) color (c) font-style (d) italic - 34.🖌️ Which CSS property sets the letter colour? (a) background-color (b) color (c) font-size (d) text-align
-
35.📱 The screen is 414px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 768px) {
p {
font-size: 14px;
}
} (a) Yes (b) No -
36.✍️ What is the selector in this CSS rule?
li {
color: red;
padding: 8px;
margin: 10px;
font-size: 20px;
} (a) body (b) color (c) li (d) 8px -
37.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 230px;
justify-content: flex-start;
}
Inside are 2 boxes, each 80px wide (no margins). - 38.🧩 Which language changes the text size? (a) JavaScript (b) HTML (c) CSS
-
39.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (max-width: 480px) {
p {
font-size: 20px;
}
} (a) Yes (b) No - 40.🔍 Which is the odd one out? (a) reacts to a button click (b) gives the page structure (c) shows a pop-up message (d) checks a quiz answer
Answer key
- picks the font style
- many pages
- the text or picture
- red
- align-items
- No
- 362
- 300px
- font-weight
- text-align
- the viewport meta tag
- 224
- Yes
- /*
- the screen width
- p
- True
- adds space around boxes
- changes the page live
- Cascading Style Sheets
- Yes
- green
- red
- 12
- makes a link
- equal gaps, none at ends
- orange
- :
- flex-direction
- <style>
- 10
- width
- font-style
- color
- Yes
- li
- 70
- CSS
- Yes
- gives the page structure
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids