Multiple choice technology web technology

What is the correct HTML for adding a background color?

  1. <background>yellow</background>

  2. <body background="yellow">

  3. <body style="background-color:yellow">

  4. <body bgcolor="yellow">

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

The correct way to add background color in modern HTML/CSS is using inline CSS with the style attribute: style="background-color:yellow". The bgcolor attribute and tag are deprecated. Using 'background' attribute on is for images, not colors.