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

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

The correct answer is: B. background-image

The background-image property is used to set the background image of an element. It takes a URL as its value, and the image will be displayed behind the element’s content. The image can be repeated, positioned, and sized using the background-repeat, background-position, and background-size properties, respectively.

The background-color property is used to set the background color of an element. It takes a color value as its value, and the color will be displayed behind the element’s content.

The background-repeat property is used to control how the background image is repeated. It can take the values repeat, repeat-x, repeat-y, or no-repeat.

The background-position property is used to control the position of the background image. It takes two values, x and y, which specify the horizontal and vertical position of the image, respectively.

The background-size property is used to control the size of the background image. It takes two values, width and height, which specify the width and height of the image, respectively.