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