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 is the odd one out? (a) changes the text size (b) sets colours and fonts (c) rounds box corners (d) counts down a timer
- 2.🎨 A CSS file usually ends with which extension? (a) .png (b) .html (c) .css (d) .js
- 3.🎯 What kind of selector is body? (a) an element selector (b) an id selector (c) a class selector
- 4.🌈 In #rrggbb, which colour do the first two digits give? (a) red (b) black (c) blue (d) green
- 5.🎯 Which sign starts a class selector? (a) @ (b) # (c) . (d) &
- 6.🧩 Which language rounds box corners? (a) JavaScript (b) HTML (c) CSS
- 7.True or false: body is an element selector. (a) True (b) False
- 8.💪 Which flexbox property spaces boxes along a row? (a) justify-content (b) gap (c) align-items (d) flex-direction
- 9.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the later one (b) neither (c) the first one (d) the shorter one
- 10.🌈 Which colour is rgb(255, 0, 255)? (a) white (b) blue (c) magenta (d) black
- 11.⚖️ Which selector is the strongest? (a) a class selector (b) an id selector (c) an element selector
- 12.🌈 In #710000 the red part is the hex number 71. What is it as a normal number?
-
13.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 80px;
padding: 15px;
border: 1px solid black;
margin: 10px;
} - 14.🧩 Which language gives the page structure? (a) JavaScript (b) CSS (c) HTML
-
15.⚖️ What colour is the text of this element?
<p class="note" id="intro">Hi</p>
CSS:
.note { color: green; }
#intro { color: black; } (a) red (b) blue (c) green (d) black -
16.🖌️ What colour is behind the letters?
li {
text-align: center;
background-color: yellow;
font-size: 24px;
color: blue;
} (a) blue (b) yellow (c) black - 17.Which of these is padding? (a) a solid or dotted edge (b) space outside the border (c) the text or picture (d) space inside the border
- 18.💪 Which flexbox property sets space between boxes? (a) justify-content (b) display: flex (c) flex-direction (d) gap
- 19.🌈 In #000065 the blue part is the hex number 65. What is it as a normal number?
- 20.📱 Which tag helps phones show a page at the right size? (a) the hr tag (b) the br tag (c) the viewport meta tag (d) the title tag
- 21.✍️ CSS declarations go inside which brackets? (a) ( ) (b) { } (c) [ ] (d) < >
-
22.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (min-width: 600px) {
p {
font-size: 16px;
}
} -
23.✍️ What is the selector in this CSS rule?
h1 {
font-size: 20px;
color: red;
} (a) font-size (b) p (c) h1 (d) red - 24.✍️ In color: blue; which part is the property? (a) blue (b) : (c) ; (d) color
- 25.📱 What does a media query check? (a) the battery level (b) the screen width (c) the page title (d) the time of day
- 26.✍️ Which sign goes between a property and its value? (a) : (b) = (c) - (d) ;
-
27.✍️ How many declarations (property: value pairs) are in this rule?
.box {
font-weight: bold;
color: red;
} - 28.True or false: JavaScript changes the page live. (a) True (b) False
- 29.💪 Which justify-content value equal gaps, none at ends? (a) space-between (b) flex-start (c) center (d) flex-end
- 30.🎨 One CSS file can style how many pages? (a) only one word (b) only one image (c) no pages (d) many pages
- 31.🌈 Which colour is #00ff00? (a) magenta (b) bright green (c) red (d) black
-
32.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 768px) {
p {
font-size: 18px;
}
} -
33.🖌️ What colour are the letters?
h2 {
font-size: 40px;
color: white;
text-align: right;
background-color: green;
} (a) white (b) green (c) red - 34.Which of these does CSS do? (a) changes the text size (b) reacts to a button click (c) makes a link (d) puts a picture on a page
- 35.🎨 Which tag holds CSS inside the head? (a) <css> (b) <script> (c) <body> (d) <style>
-
36.✍️ What is the selector in this CSS rule?
.note {
text-align: center;
font-style: italic;
width: 300px;
} (a) italic (b) text-align (c) .note (d) #top - 37.🌈 Hex digits go 0 to 9, then A to which letter? (a) F (b) Z (c) G (d) J
- 38.🎨 Which tag connects an outside CSS file? (a) <link> (b) <img> (c) <a> (d) <css>
-
39.✍️ What value is given to width in this rule?
h1 {
text-align: center;
width: 300px;
} (a) red (b) 300px (c) width (d) italic - 40.🖌️ Which CSS property picks the font style? (a) font-family (b) text-align (c) color (d) font-size
Answer key
- counts down a timer
- .css
- an element selector
- red
- .
- CSS
- True
- justify-content
- the later one
- magenta
- an id selector
- 113
- 132
- HTML
- black
- yellow
- space inside the border
- gap
- 101
- the viewport meta tag
- { }
- 12
- h1
- color
- the screen width
- :
- 2
- True
- space-between
- many pages
- bright green
- 18
- white
- changes the text size
- <style>
- .note
- F
- <link>
- 300px
- font-family
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids