1. Which property is used to change the background color of an element in CSS?
Hint:
background-color is used to set the background color of an element.
Example:
`element { background-color: red; }`
2. What does the z-index property in CSS control?
Hint:
z-index controls the stacking order of elements. A higher value is stacked above elements with a lower value.
Example:
`element { z-index: 10; }`
3. Which of the following is the correct CSS syntax to select all p elements inside a div?
Hint:
The correct syntax selects all `p` elements inside any `div`.
Example:
`div p { color: red; }`
4. Which CSS property is used to change the text color of an element?
Hint:
The color property sets the text color.
Example:
`element { color: blue; }`
5. What is the default value of the position property in CSS?
Hint:
The default value for the position property is `static`. This means elements are positioned according to the normal document flow.
Example:
`element { position: static; }`
6. Which property is used to add space between the content of a box and its border in CSS?
Hint:
The padding property is used to add space between the content and the border of an element.
Example:
`element { padding: 10px; }`
7. How can you apply a CSS rule only when a user hovers over an element?
Hint:
The :hover pseudo-class is used to apply styles when an element is hovered over.
Example:
`element:hover { background-color: yellow; }`
8. Which of the following units is relative to the font size of the parent element in CSS?
Hint:
The `em` unit is relative to the font size of the parent element.
Example:
`element { font-size: 2em; }`
9. Which CSS property is used to set the space between characters of text?
Hint:
The `letter-spacing` property is used to adjust the space between characters.
Example:
`element { letter-spacing: 2px; }`
10. How do you select all elements with a class of "highlight" in CSS?
Hint:
To select all elements with a class of "highlight", you use a dot (.) before the class name.
Example:
`.highlight { color: red; }`