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.✍️ In color: blue; which part is the value? (a) color (b) ; (c) : (d) blue
- 2.🌈 Which colour of light is strongest in rgb(127, 3, 233)? (a) blue (b) red (c) green
-
3.✍️ Which property is set to 300px in this rule?
p {
margin: 10px;
width: 300px;
} (a) 300px (b) width (c) font-style (d) color - 4.🎨 Which tag holds CSS inside the head? (a) <css> (b) <body> (c) <script> (d) <style>
-
5.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 200px;
justify-content: center;
}
Inside are 3 boxes, each 40px wide (no margins). - 6.🌈 Hex digits go 0 to 9, then A to which letter? (a) Z (b) F (c) G (d) J
- 7.🎯 Which element does the selector p style? (a) <h1> (b) <li id="intro"> (c) <p class="box"> (d) <h2 class="box">
- 8.✍️ CSS declarations go inside which brackets? (a) { } (b) [ ] (c) < > (d) ( )
-
9.🎯 Which CSS selector matches this element?
<div class="menu" id="top">Hello</div> (a) #menu (b) span (c) #intro (d) .menu - 10.True or false: the border is the text or picture. (a) False (b) True
- 11.💪 Which justify-content value packs boxes at the end? (a) flex-start (b) center (c) space-between (d) flex-end
- 12.🎯 Which element does the selector .big style? (a) <h1 id="big"> (b) <h1 class="red"> (c) <h1 class="big"> (d) <h2 class="box">
- 13.What does justify-content: center do? (a) equal gaps, none at ends (b) packs boxes at the end (c) packs boxes at the start (d) puts boxes in the middle
-
14.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 180px;
padding: 5px;
border: 3px solid black;
margin: 0px;
} - 15.🌈 In #rrggbb, which colour do the last two digits give? (a) white (b) blue (c) red (d) green
-
16.🖌️ Where does the text sit on its line?
p {
color: red;
background-color: white;
font-size: 36px;
text-align: left;
} (a) on the left (b) on the right (c) in the middle - 17.What does font-weight do? (a) picks the font style (b) sets the letter colour (c) centres a heading (d) makes the text bold
-
18.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 50px;
padding: 10px;
border: 4px solid black;
margin: 5px;
} -
19.⚖️ What colour is the text of this element?
<h1 class="big" id="intro">Hi</h1>
CSS:
h1 { color: blue; }
#intro { color: purple; }
.big { color: black; } (a) purple (b) white (c) blue (d) black -
20.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 140px;
justify-content: flex-start;
}
Inside are 2 boxes, each 50px wide (no margins). - 21.🎯 Which element does the selector #logo style? (a) <div id="logo"> (b) <div class="logo"> (c) <div id="end"> (d) <span class="box">
- 22.Which of these is the content? (a) space inside the border (b) the text or picture (c) the line round the box (d) the gap round content
-
23.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 270px;
justify-content: flex-end;
}
Inside are 2 boxes, each 100px wide (no margins). - 24.📱 Responsive design means a page ___. (a) never changes (b) fits every screen (c) has no pictures (d) is only for laptops
-
25.✍️ How many declarations (property: value pairs) are in this rule?
li {
width: 300px;
font-size: 20px;
border: 2px solid;
color: red;
} -
26.✍️ What value is given to width in this rule?
body {
font-size: 20px;
width: 300px;
font-style: italic;
} (a) red (b) 300px (c) italic (d) width -
27.🖌️ What colour are the letters?
li {
font-size: 12px;
background-color: white;
text-align: left;
color: green;
} (a) white (b) green (c) yellow - 28.🌈 Which colour is rgb(0, 0, 0)? (a) bright green (b) white (c) black (d) blue
- 29.🖌️ Which CSS property makes the text bold? (a) color (b) text-align (c) font-family (d) font-weight
-
30.⚖️ What colour is the text of this element?
<p class="red" id="end">Hi</p>
CSS:
p { color: black; }
.red { color: purple; }
#end { color: red; } (a) red (b) purple (c) black (d) blue - 31.⚖️ Which selector is the weakest? (a) an element selector (b) a class selector (c) an id selector
-
32.✍️ How many declarations (property: value pairs) are in this rule?
p {
font-size: 20px;
color: red;
background-color: yellow;
} -
33.⚖️ What colour is the text of this element?
<h2 class="star" id="hero">Hi</h2>
CSS:
.star { color: green; }
h2 { color: yellow; }
#hero { color: blue; } (a) red (b) green (c) blue (d) yellow - 34.🧩 Which language gives the page structure? (a) JavaScript (b) HTML (c) CSS
- 35.📱 max-width: 600px applies when the screen is ___. (a) 600px or wider (b) exactly 1000px (c) turned off (d) 600px or narrower
- 36.What does font-size do? (a) colours behind the text (b) picks the font style (c) makes letters bigger (d) centres a heading
- 37.📦 In the box model, which part is space outside the border? (a) border (b) padding (c) content (d) margin
- 38.📱 What does a media query check? (a) the screen width (b) the page title (c) the time of day (d) the battery level
-
39.⚖️ What colour is the text of this element?
<h2 class="big" id="main">Hi</h2>
CSS:
.big { color: blue; }
.big { color: green; } (a) orange (b) blue (c) purple (d) green - 40.True or false: p is an element selector. (a) False (b) True
Answer key
- blue
- blue
- width
- <style>
- 40
- F
- <p class="box">
- { }
- .menu
- False
- flex-end
- <h1 class="big">
- puts boxes in the middle
- 196
- blue
- on the left
- makes the text bold
- 88
- purple
- 40
- <div id="logo">
- the text or picture
- 70
- fits every screen
- 4
- 300px
- green
- black
- font-weight
- red
- an element selector
- 3
- blue
- HTML
- 600px or narrower
- makes letters bigger
- margin
- the screen width
- green
- True
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids