Which property is used to change the background color?
-
color:
-
bgcolor:
-
background-color:
-
None of the above
The background-color CSS property is used to change an element's background color. The color property only changes text color, while bgcolor is an outdated HTML attribute that should not be used in modern CSS.
To answer this question, you need to understand CSS (Cascading Style Sheets) properties.
The correct answer is C) background-color.
Explanation:
A) color: This property is used to change the text color, not the background color.
B) bgcolor: This property was used in older versions of HTML to change the background color, but it is no longer supported in modern web development.
C) background-color: This property is used to change the background color of an element. It allows you to specify a color using various formats such as named colors (e.g., "red", "blue"), hexadecimal values (e.g., "#FF0000", "#0000FF"), RGB values (e.g., "rgb(255, 0, 0)", "rgb(0, 0, 255)"), or HSL values (e.g., "hsl(0, 100%, 50%)", "hsl(240, 100%, 50%)").
D) None of the above: This option is incorrect because the correct answer is C) background-color.
Therefore, the correct answer is C) background-color. This option is correct because it is the CSS property used to change the background color of an element.