HTML body bgcolor attribute
Examples
The HTML document specifies a background color:
<h1>Hello world!</h1>
<p><a href="http://www.w3big.com/">访问 w3big.com!</a></p>
<p><a href="http://www.w3big.com/">访问 w3big.com!</a></p>
try it"
Browser Support
All major browsers support the bgcolor attribute.
Definition and Usage
HTML5 is no longer supported <body> bgcolor attribute. Use CSS instead.
<Body> bgcolor attribute is deprecated in HTML 4.01.
bgcolor attribute specifies the background color of the document.
Compatibility Notes
In HTML 4.01 deprecated bgcolor attribute of the body element; in XHTML 1.0 Strict DTD not supported bgcolor attribute of the body element. Use CSS instead.
CSS Syntax: <body style = "background-color: # E6E6FA">
CSS Example: set the background color of the document
I In our CSS tutorial you can find more information about the background-color detail.
grammar
<body bgcolor="color_name|hex_number|rgb_number">
Property Value
value | description |
---|---|
color_name | Predetermined color is the color of the font color name (such as "red"). |
hex_number | Predetermined color value is a hexadecimal value of font color (eg "# ff0000"). |
rgb_number | Rgb color code is specified font color (such as "rgb (255,0,0)"). |
HTML <body> tag