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. bgcolor — 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…
- A.
bgcolor
- B.
background
- C.
color
- 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.