CSS Worksheet: CSS Rules and Syntax
Code tip (Colon in the middle, semicolon at the end): A rule is: selector { property: value; property: value; } The property is before the colon, the value after it; a semicolon ends each declaration. Count the property: value; lines to count the declarations.
NameDateTime takenScore ___ / 40
-
1.✍️ Which property is set to red in this rule?
.note {
color: red;
font-style: italic;
text-align: center;
font-size: 20px;
} (a) font-size (b) red (c) color (d) text-align -
2.✍️ Which property is set to 20px in this rule?
#top {
font-size: 20px;
width: 300px;
text-align: center;
} (a) text-align (b) font-size (c) background-color (d) 20px - 3.✍️ Which sign goes between a property and its value? (a) ; (b) : (c) - (d) =
-
4.✍️ Which property is set to italic in this rule?
h2 {
border: 2px solid;
font-style: italic;
} (a) italic (b) font-style (c) color (d) font-size - 5.✍️ In color: blue; which part is the property? (a) color (b) : (c) ; (d) blue
-
6.✍️ How many declarations (property: value pairs) are in this rule?
p {
font-weight: bold;
width: 300px;
color: red;
text-align: center;
} -
7.✍️ What is the selector in this CSS rule?
#top {
width: 300px;
background-color: yellow;
margin: 10px;
color: red;
} (a) #top (b) yellow (c) width (d) li -
8.✍️ Which property is set to 8px in this rule?
body {
padding: 8px;
border: 2px solid;
color: red;
} (a) 8px (b) border (c) font-weight (d) padding -
9.✍️ How many declarations (property: value pairs) are in this rule?
li {
font-weight: bold;
font-size: 20px;
font-style: italic;
width: 300px;
} - 10.✍️ Which sign ends each CSS declaration? (a) ; (b) . (c) : (d) ,
-
11.✍️ What value is given to background-color in this rule?
.note {
padding: 8px;
font-size: 20px;
text-align: center;
background-color: yellow;
} (a) background-color (b) 8px (c) 10px (d) yellow -
12.✍️ What value is given to font-size in this rule?
body {
font-size: 20px;
border: 2px solid;
background-color: yellow;
} (a) yellow (b) font-size (c) center (d) 20px -
13.✍️ How many declarations (property: value pairs) are in this rule?
.box {
font-size: 20px;
font-style: italic;
} -
14.✍️ What is the selector in this CSS rule?
h1 {
width: 300px;
font-style: italic;
color: red;
padding: 8px;
} (a) italic (b) width (c) p (d) h1 -
15.✍️ What value is given to font-size in this rule?
.note {
font-size: 20px;
background-color: yellow;
border: 2px solid;
padding: 8px;
} (a) 20px (b) font-size (c) yellow (d) center - 16.✍️ CSS declarations go inside which brackets? (a) { } (b) < > (c) ( ) (d) [ ]
-
17.✍️ What value is given to font-weight in this rule?
#top {
font-weight: bold;
padding: 8px;
font-size: 20px;
background-color: yellow;
} (a) 300px (b) bold (c) font-weight (d) 2px solid -
18.✍️ Which property is set to 300px in this rule?
p {
width: 300px;
color: red;
} (a) width (b) color (c) 300px (d) font-style - 19.✍️ How does a CSS comment start? (a) <!-- (b) /* (c) // (d) #
-
20.✍️ Which property is set to italic in this rule?
li {
font-size: 20px;
font-style: italic;
} (a) color (b) font-style (c) italic (d) font-size -
21.✍️ Which property is set to yellow in this rule?
.note {
font-size: 20px;
text-align: center;
border: 2px solid;
background-color: yellow;
} (a) yellow (b) background-color (c) margin (d) padding -
22.✍️ Which property is set to 20px in this rule?
body {
font-size: 20px;
border: 2px solid;
} (a) 20px (b) font-size (c) text-align (d) background-color -
23.✍️ What is the selector in this CSS rule?
h1 {
margin: 10px;
font-size: 20px;
border: 2px solid;
} (a) p (b) h1 (c) 20px (d) margin -
24.✍️ Which property is set to 2px solid in this rule?
h1 {
font-weight: bold;
border: 2px solid;
font-size: 20px;
color: red;
} (a) 2px solid (b) width (c) border (d) font-style -
25.✍️ What value is given to color in this rule?
p {
font-style: italic;
font-size: 20px;
color: red;
} (a) 20px (b) red (c) color (d) center -
26.✍️ What is the selector in this CSS rule?
p {
margin: 10px;
padding: 8px;
} (a) .note (b) margin (c) 8px (d) p -
27.✍️ Which property is set to italic in this rule?
h2 {
margin: 10px;
border: 2px solid;
font-style: italic;
background-color: yellow;
} (a) color (b) font-size (c) italic (d) font-style -
28.✍️ Which property is set to 20px in this rule?
#top {
background-color: yellow;
font-size: 20px;
} (a) 20px (b) background-color (c) text-align (d) font-size -
29.✍️ Which property is set to bold in this rule?
.box {
padding: 8px;
font-weight: bold;
} (a) width (b) bold (c) border (d) font-weight -
30.✍️ What value is given to font-size in this rule?
h1 {
font-style: italic;
font-size: 20px;
padding: 8px;
} (a) yellow (b) font-size (c) center (d) 20px -
31.✍️ What value is given to text-align in this rule?
li {
text-align: center;
padding: 8px;
border: 2px solid;
margin: 10px;
} (a) 10px (b) center (c) yellow (d) text-align -
32.✍️ What is the selector in this CSS rule?
#top {
margin: 10px;
font-style: italic;
background-color: yellow;
color: red;
} (a) italic (b) margin (c) #top (d) li -
33.✍️ What is the selector in this CSS rule?
.note {
color: red;
width: 300px;
} (a) #top (b) .note (c) 300px (d) color -
34.✍️ Which property is set to italic in this rule?
p {
padding: 8px;
background-color: yellow;
margin: 10px;
font-style: italic;
} (a) font-style (b) italic (c) font-size (d) color -
35.✍️ What value is given to font-style in this rule?
.note {
font-style: italic;
padding: 8px;
background-color: yellow;
} (a) italic (b) font-style (c) red (d) 20px -
36.✍️ How many declarations (property: value pairs) are in this rule?
h1 {
width: 300px;
text-align: center;
} -
37.✍️ What value is given to text-align in this rule?
h1 {
text-align: center;
padding: 8px;
width: 300px;
} (a) yellow (b) center (c) text-align (d) 10px -
38.✍️ How many declarations (property: value pairs) are in this rule?
h2 {
font-weight: bold;
font-size: 20px;
color: red;
border: 2px solid;
} -
39.✍️ What is the selector in this CSS rule?
h1 {
border: 2px solid;
width: 300px;
background-color: yellow;
} (a) 300px (b) border (c) h1 (d) p -
40.✍️ Which property is set to 20px in this rule?
p {
font-size: 20px;
padding: 8px;
} (a) 20px (b) background-color (c) text-align (d) font-size
Answer key
- color
- font-size
- :
- font-style
- color
- 4
- #top
- padding
- 4
- ;
- yellow
- 20px
- 2
- h1
- 20px
- { }
- bold
- width
- /*
- font-style
- background-color
- font-size
- h1
- border
- red
- p
- font-style
- font-size
- font-weight
- 20px
- center
- #top
- .note
- font-style
- italic
- 2
- center
- 4
- h1
- font-size
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids