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 is the selector in this CSS rule?
li {
padding: 8px;
text-align: center;
background-color: yellow;
} (a) body (b) padding (c) li (d) center -
2.🖌️ How big is the text, in px?
h2 {
text-align: left;
color: orange;
background-color: black;
font-size: 28px;
} - 3.True or false: #end is a class selector. (a) False (b) True
- 4.📱 min-width: 800px applies when the screen is ___. (a) 800px or wider (b) exactly 100px (c) turned off (d) 800px or narrower
- 5.⚖️ 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
-
6.🎯 Which CSS selector matches this element?
<h2 class="red" id="logo">Hello</h2> (a) .box (b) #red (c) .red (d) li - 7.Which of these is the content? (a) the text or picture (b) the gap round content (c) a solid or dotted edge (d) space inside the border
-
8.⚖️ What colour is the text of this element?
<h2 class="note" id="top">Hi</h2>
CSS:
#top { color: orange; }
#top { color: black; } (a) red (b) orange (c) black (d) purple -
9.⚖️ What colour is the text of this element?
<h1 class="note" id="intro">Hi</h1>
CSS:
h1 { color: green; }
h1 { color: orange; } (a) red (b) green (c) orange (d) black - 10.🎯 What kind of selector is h1? (a) an id selector (b) a class selector (c) an element selector
- 11.Which of these does CSS do? (a) puts a picture on a page (b) changes the page live (c) makes a form box (d) changes the text size
-
12.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (max-width: 480px) {
p {
font-size: 18px;
}
} - 13.✍️ Which sign goes between a property and its value? (a) - (b) = (c) : (d) ;
- 14.🌈 In #290000 the red part is the hex number 29. What is it as a normal number?
-
15.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 220px;
padding: 5px;
border: 5px solid black;
margin: 10px;
} - 16.🎯 Which element does the selector .box style? (a) <span class="star"> (b) <span class="box"> (c) <p class="menu"> (d) <span id="box">
- 17.🌈 Which colour is rgb(255, 255, 255)? (a) yellow (b) bright green (c) blue (d) white
-
18.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 140px;
padding: 5px;
border: 4px solid black;
margin: 20px;
} -
19.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 160px;
justify-content: flex-end;
}
Inside are 2 boxes, each 60px wide (no margins). - 20.Which of these does HTML do? (a) checks a quiz answer (b) makes a form box (c) lays out the page (d) counts down a timer
- 21.True or false: .star is an element selector. (a) True (b) False
-
22.⚖️ What colour is the text of this element?
<p class="note" id="top">Hi</p>
CSS:
#top { color: blue; }
#top { color: purple; } (a) black (b) purple (c) blue (d) orange - 23.Which of these does CSS do? (a) counts down a timer (b) gives the page structure (c) lays out the page (d) puts a picture on a page
- 24.🎨 What does CSS stand for? (a) Cascading Style Sheets (b) Computer Style Sheets (c) Creative Sheet System (d) Colourful Site Styles
- 25.🎯 Which sign starts an id selector? (a) & (b) . (c) @ (d) #
- 26.Which of these does CSS do? (a) reacts to a button click (b) gives the page structure (c) adds space around boxes (d) puts a picture on a page
- 27.What does color do? (a) centres a heading (b) sets the letter colour (c) colours behind the text (d) makes letters bigger
- 28.✍️ CSS declarations go inside which brackets? (a) { } (b) [ ] (c) ( ) (d) < >
- 29.📦 In the box model, which part is the gap round content? (a) content (b) padding (c) border (d) margin
-
30.🎯 Which CSS selector matches this element?
<span class="big" id="logo">Hello</span> (a) .big (b) #big (c) .logo (d) #end - 31.True or false: JavaScript makes headings and lists. (a) False (b) True
- 32.💪 Which justify-content value packs boxes at the end? (a) space-between (b) flex-end (c) center (d) flex-start
-
33.🖌️ Where does the text sit on its line?
li {
text-align: left;
font-size: 12px;
color: blue;
background-color: orange;
} (a) on the right (b) on the left (c) in the middle -
34.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 400px;
justify-content: flex-end;
}
Inside are 4 boxes, each 80px wide (no margins). - 35.✍️ Which sign ends each CSS declaration? (a) . (b) , (c) ; (d) :
- 36.🎯 How many elements on a page should have the same id? (a) 1 (b) 2 (c) any number (d) 5
-
37.📱 The screen is 1366px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (min-width: 768px) {
p {
font-size: 18px;
}
} (a) No (b) Yes - 38.🎯 What kind of selector is .big? (a) a class selector (b) an id selector (c) an element selector
- 39.🎯 Which element does the selector .box style? (a) <h1 class="star"> (b) <h2 class="menu"> (c) <h1 class="box"> (d) <h1 id="box">
-
40.📱 The screen is 540px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 480px) {
p {
font-size: 10px;
}
} (a) Yes (b) No
Answer key
- li
- 28
- False
- 800px or wider
- the later one
- .red
- the text or picture
- black
- orange
- an element selector
- changes the text size
- 18
- :
- 41
- 260
- <span class="box">
- white
- 158
- 40
- makes a form box
- False
- purple
- lays out the page
- Cascading Style Sheets
- #
- adds space around boxes
- sets the letter colour
- { }
- padding
- .big
- False
- flex-end
- on the left
- 80
- ;
- 1
- Yes
- a class selector
- <h1 class="box">
- No
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids