html tutorial - bgcolor Attribute in HTML - html5 - html code - html form




Bgcolor attribute in html

Learn html - html tutorial - Bgcolor attribute in html - html examples - html programs

  • The bgcolor is used to set the background color.
  • Hence it does not support in HTML5 version.

Syntax for bgcolor attribute in HTML:

<element bgcolor=”value”>

Differences between HTML 4.01 and HTML5 for bgcolor attribute:

HTML 4.01

  • HTML4 support bgcolor attribute.

HTML5

  • HTML5 does not support bgcolor attribute.

Applies to:

Elements Attribute
<body> bgcolor
<table> bgcolor
<tr> bgcolor
<td> bgcolor

Attribute values for bgcolor attribute:

Value Description
color_name Specifies the background color with a color name (like "red")
hex_number Specifies the background color with a hex code (like "#ff0000")
rgb_number Specifies the background color with an rgb code (like "rgb(255,0,0)")

Sample coding for bgcolor attribute in HTML:

Tryit<!DOCTYPE html>
<html>
    <body bgcolor="sky blue">
        <h1>Welcome to Wikitechy!</h1>
        <p>
            <a href="http://www.wikitechy.com">Visit Wikitechy.com!</a>
        </p>
    </body>
</html>

Code Explanation for bgcolor attribute in HTML:

bgcolor Attribute Code Explanation

  1. The bgcolor attribute is used to set the background color for the body of the HTML document.

Output for bgcolor attribute in HTML:

bgcolor Attribute Output

  1. The output shows the skyblue color as a background color of the HTML document.

Browser Support for bgcolor attribute in HTML:

Yes Yes Yes Yes Yes

Related Searches to bgcolor Attribute in html