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.True or false: JavaScript gives the page structure. (a) True (b) False
-
2.🎯 Which CSS selector matches this element?
<li class="menu" id="intro">Hello</li> (a) div (b) li (c) .intro (d) #menu - 3.✍️ In color: blue; which part is the property? (a) color (b) blue (c) : (d) ;
- 4.✍️ CSS declarations go inside which brackets? (a) { } (b) [ ] (c) ( ) (d) < >
- 5.🎨 Which tag connects an outside CSS file? (a) <css> (b) <a> (c) <link> (d) <img>
- 6.🌈 Which colour is rgb(0, 0, 0)? (a) cyan (b) blue (c) white (d) black
- 7.🌈 Which colour is #ffffff? (a) black (b) magenta (c) cyan (d) white
-
8.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (max-width: 1024px) {
p {
font-size: 20px;
}
} - 9.Which of these does CSS do? (a) puts a picture on a page (b) rounds box corners (c) shows a pop-up message (d) changes the page live
- 10.True or false: JavaScript puts a picture on a page. (a) True (b) False
- 11.🌈 In #100000 the red part is the hex number 10. What is it as a normal number?
- 12.🎯 What kind of selector is .star? (a) an element selector (b) an id selector (c) a class selector
- 13.🎯 Which element does the selector p style? (a) <p class="menu"> (b) <h1> (c) <li id="end"> (d) <h2 class="menu">
- 14.🌈 Which colour is rgb(255, 0, 0)? (a) cyan (b) red (c) yellow (d) bright green
-
15.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 220px;
padding: 30px;
border: 3px solid black;
margin: 0px;
} - 16.🎨 What does CSS stand for? (a) Creative Sheet System (b) Computer Style Sheets (c) Cascading Style Sheets (d) Colourful Site Styles
-
17.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (min-width: 600px) {
p {
font-size: 26px;
}
} -
18.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (min-width: 768px) {
p {
font-size: 16px;
}
} - 19.📱 max-width: 600px applies when the screen is ___. (a) turned off (b) 600px or wider (c) 600px or narrower (d) exactly 1000px
- 20.What does justify-content: center do? (a) packs boxes at the end (b) puts boxes in the middle (c) packs boxes at the start (d) equal gaps, none at ends
- 21.🌈 Which colour of light is strongest in rgb(0, 0, 186)? (a) red (b) green (c) blue
- 22.🎯 Which element does the selector h2 style? (a) <div class="note"> (b) <h2 class="note"> (c) <li> (d) <span id="top">
- 23.True or false: padding is the gap round content. (a) True (b) False
- 24.📱 What does a media query check? (a) the battery level (b) the time of day (c) the screen width (d) the page title
- 25.True or false: the border is the gap to other boxes. (a) False (b) True
-
26.🖌️ What colour is behind the letters?
h2 {
text-align: right;
font-size: 16px;
color: black;
background-color: purple;
} (a) yellow (b) black (c) purple -
27.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 200px;
padding: 25px;
border: 3px solid black;
margin: 15px;
} - 28.What does background-color do? (a) makes the text bold (b) colours behind the text (c) picks the font style (d) makes letters bigger
-
29.🎯 Which CSS selector matches this element?
<p class="star" id="intro">Hello</p> (a) #intro (b) .intro (c) #main (d) .menu - 30.📱 Which tag helps phones show a page at the right size? (a) the title tag (b) the viewport meta tag (c) the br tag (d) the hr tag
- 31.✍️ Which sign ends each CSS declaration? (a) . (b) , (c) : (d) ;
- 32.🌈 Which colour is #00ffff? (a) yellow (b) cyan (c) red (d) blue
-
33.🎯 Which CSS selector matches this element?
<li class="menu" id="top">Hello</li> (a) #intro (b) li (c) .top (d) div - 34.💪 Which flexbox property turns on flexbox? (a) justify-content (b) display: flex (c) flex-direction (d) align-items
- 35.True or false: JavaScript sets colours and fonts. (a) False (b) True
-
36.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 600px) {
p {
font-size: 10px;
}
} -
37.🖌️ What colour are the letters?
h1 {
background-color: white;
text-align: left;
font-size: 32px;
color: orange;
} (a) orange (b) red (c) white - 38.True or false: #end is an element selector. (a) False (b) True
-
39.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 90px;
padding: 30px;
border: 1px solid black;
margin: 10px;
} -
40.✍️ Which property is set to center in this rule?
.note {
background-color: yellow;
margin: 10px;
font-style: italic;
text-align: center;
} (a) background-color (b) center (c) margin (d) text-align
Answer key
- False
- li
- color
- { }
- <link>
- black
- white
- 24
- rounds box corners
- False
- 16
- a class selector
- <p class="menu">
- red
- 286
- Cascading Style Sheets
- 20
- 12
- 600px or narrower
- puts boxes in the middle
- blue
- <h2 class="note">
- True
- the screen width
- False
- purple
- 256
- colours behind the text
- #intro
- the viewport meta tag
- ;
- cyan
- li
- display: flex
- False
- 10
- orange
- False
- 172
- text-align
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids