Which HTML tag with inline style correctly changes the page background color to purple?

Prepare for the Web Design EOPA Test. Study with interactive quizzes and multiple-choice questions, complete with hints and detailed explanations. Get ready for your web design certification!

Multiple Choice

Which HTML tag with inline style correctly changes the page background color to purple?

Explanation:
Changing the page background color is done by applying CSS directly to the body element. Using an inline style on the body with background-color set to purple colors the entire page backdrop, because the body represents all the visible content of the page. The color value purple is a valid CSS color name, so the declaration style="background-color:purple;" works cleanly and keeps the styling in the HTML tag itself. The other approaches don’t guarantee a full-page background. A legacy bgcolor attribute on the body uses an old HTML attribute rather than inline CSS and isn’t the modern method. Styling a div or a header with background-color affects only that element (unless that element spans the whole page, which isn’t guaranteed), so they wouldn’t reliably set the entire page background.

Changing the page background color is done by applying CSS directly to the body element. Using an inline style on the body with background-color set to purple colors the entire page backdrop, because the body represents all the visible content of the page. The color value purple is a valid CSS color name, so the declaration style="background-color:purple;" works cleanly and keeps the styling in the HTML tag itself.

The other approaches don’t guarantee a full-page background. A legacy bgcolor attribute on the body uses an old HTML attribute rather than inline CSS and isn’t the modern method. Styling a div or a header with background-color affects only that element (unless that element spans the whole page, which isn’t guaranteed), so they wouldn’t reliably set the entire page background.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy