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.✍️ CSS declarations go inside which brackets? (a) < > (b) ( ) (c) { } (d) [ ]
- 2.Which of these is the border? (a) space inside the border (b) the gap to other boxes (c) the line round the box (d) the gap round content
-
3.✍️ Which property is set to center in this rule?
p {
text-align: center;
color: red;
} (a) background-color (b) text-align (c) center (d) margin - 4.Which of these does JavaScript do? (a) makes a link (b) lays out the page (c) makes headings and lists (d) checks a quiz answer
- 5.🌈 In #000069 the blue part is the hex number 69. What is it as a normal number?
- 6.🧩 Which language shows a pop-up message? (a) CSS (b) JavaScript (c) HTML
- 7.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 6 (b) 4 (c) 3 (d) 2
- 8.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
-
9.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 768px) {
p {
font-size: 12px;
}
} (a) Yes (b) No - 10.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the first one (b) the shorter one (c) neither (d) the later one
-
11.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 480px) {
p {
font-size: 10px;
}
} (a) No (b) Yes - 12.🖌️ Which CSS property colours behind the text? (a) color (b) background-color (c) font-weight (d) font-size
-
13.🖌️ What colour are the letters?
p {
text-align: center;
font-size: 16px;
background-color: blue;
color: red;
} (a) orange (b) blue (c) red - 14.🧩 Which language checks a quiz answer? (a) JavaScript (b) CSS (c) HTML
-
15.✍️ How many declarations (property: value pairs) are in this rule?
body {
padding: 8px;
color: red;
} -
16.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 768px) {
p {
font-size: 8px;
}
} (a) No (b) Yes - 17.💪 Which justify-content value equal gaps, none at ends? (a) space-between (b) flex-end (c) flex-start (d) center
- 18.True or false: HTML makes a form box. (a) False (b) True
- 19.✍️ In color: blue; which part is the property? (a) ; (b) blue (c) : (d) color
- 20.🌈 In #rrggbb, which colour do the last two digits give? (a) white (b) blue (c) green (d) red
- 21.🎨 A CSS file usually ends with which extension? (a) .js (b) .png (c) .html (d) .css
- 22.🔍 Which is the odd one out? (a) lays out the page (b) sets colours and fonts (c) reacts to a button click (d) rounds box corners
-
23.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 180px;
padding: 15px;
border: 2px solid black;
margin: 5px;
} - 24.🖌️ Which CSS property picks the font style? (a) font-family (b) color (c) font-size (d) background-color
-
25.✍️ How many declarations (property: value pairs) are in this rule?
.note {
font-size: 20px;
margin: 10px;
text-align: center;
background-color: yellow;
} -
26.✍️ What is the selector in this CSS rule?
#top {
border: 2px solid;
text-align: center;
} (a) #top (b) center (c) li (d) border -
27.🎯 Which CSS selector matches this element?
<p class="menu" id="hero">Hello</p> (a) h1 (b) #hero (c) #top (d) .note -
28.🖌️ What colour are the letters?
h2 {
font-size: 12px;
text-align: left;
color: red;
background-color: orange;
} (a) red (b) orange (c) green - 29.🎯 Can many elements share the same class? (a) No (b) Yes
- 30.✍️ How does a CSS comment start? (a) <!-- (b) // (c) /* (d) #
- 31.🎯 What kind of selector is #end? (a) a class selector (b) an id selector (c) an element selector
- 32.📱 min-width: 800px applies when the screen is ___. (a) turned off (b) exactly 100px (c) 800px or narrower (d) 800px or wider
- 33.🎨 What does CSS stand for? (a) Computer Style Sheets (b) Cascading Style Sheets (c) Creative Sheet System (d) Colourful Site Styles
- 34.🎯 Which element does the selector h2 style? (a) <span id="main"> (b) <h2 class="box"> (c) <div class="box"> (d) <li>
-
35.✍️ How many declarations (property: value pairs) are in this rule?
h2 {
margin: 10px;
border: 2px solid;
font-weight: bold;
padding: 8px;
} - 36.🌈 Which colour is rgb(0, 0, 255)? (a) magenta (b) black (c) bright green (d) blue
- 37.True or false: HTML puts a picture on a page. (a) False (b) True
- 38.What does justify-content: flex-end 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
-
39.✍️ What is the selector in this CSS rule?
.box {
background-color: yellow;
margin: 10px;
font-weight: bold;
font-style: italic;
} (a) h2 (b) 10px (c) .box (d) background-color -
40.📱 The screen is 414px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 1024px) {
p {
font-size: 30px;
}
} (a) No (b) Yes
Answer key
- { }
- the line round the box
- text-align
- checks a quiz answer
- 105
- JavaScript
- 3
- equal gaps, none at ends
- Yes
- the later one
- Yes
- background-color
- red
- JavaScript
- 2
- Yes
- space-between
- True
- color
- blue
- .css
- reacts to a button click
- 224
- font-family
- 4
- #top
- #hero
- red
- Yes
- /*
- an id selector
- 800px or wider
- Cascading Style Sheets
- <h2 class="box">
- 4
- blue
- True
- packs boxes at the end
- .box
- No
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids