Which of the following HTML attributes is used to specify the background color…

2025

Which of the following HTML attributes is used to specify the background color of page ?

Answer: A. bgcolorThe correct answer is Option A (bgcolor). In HTML, the bgcolor attribute was specifically designed to set the background color of a document or element…

  1. A.

    bgcolor

  2. B.

    background

  3. C.

    color

  4. D.

    bg-color

Attempted by 308 students.

Show answer & explanation

Correct answer: A

The correct answer is Option A (bgcolor). In HTML, the bgcolor attribute was specifically designed to set the background color of a document or element directly within the HTML tag, such as <body bgcolor="yellow">. Although modern web development prefers using CSS for styling to separate content from presentation, the bgcolor attribute remains the standard answer in traditional HTML contexts for this specific function.\nOption B (background) is incorrect because it specifies a URL to an image file for the background, not a color value. Option C (color) is incorrect as it typically defines text color for specific elements like headings or paragraphs, not the page background itself. Option D (bg-color) is incorrect because it is not a valid HTML attribute; while CSS uses 'background-color', this specific syntax does not exist as an HTML tag attribute.

Explore the full course: Tpsc Assistant Technical Officer

Loading lesson…