Which of the following property is used to set the background color of an element?

background-color
background-image
background-repeat
background-position

The correct answer is: A. background-color

The background-color property is used to set the background color of an element. It can be used to set a solid color, a gradient, or an image.

The background-image property is used to set a background image for an element. The image can be repeated, positioned, and scaled.

The background-repeat property is used to control how the background image is repeated. The possible values are repeat, repeat-x, repeat-y, and no-repeat.

The background-position property is used to control the position of the background image. The possible values are top, bottom, left, right, center, and center-center.

Here is an example of how to use the background-color property to set a solid color background for an element:

“`html

This is a div with a red background.

“`

Here is an example of how to use the background-image property to set a background image for an element:

“`html

This is a div with a background image.

“`

Here is an example of how to use the background-repeat property to repeat the background image:

“`html

This is a div with a repeated background image.

“`

Here is an example of how to use the background-position property to position the background image:

“`html

This is a div with a background image that is positioned at the top left corner.

“`