Latest web development tutorials

HTML table bgcolor attribute

HTML table tag Reference Manual HTML <table> tag

Examples

HTML table with background color:

<table border="1" bgcolor="#00FF00">
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
</table>

try it"

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the bgcolor attribute.


Definition and Usage

HTML5 does not support the <table> bgcolor attribute. Use CSS instead.

In HTML 4.01, <table> the bgcolor attribute obsolete .

bgcolor attribute specifies the background color of table.


Compatibility Notes

In HTML 4.01, <table> the bgcolor attribute obsolete, please use CSS instead.

CSS syntax: <table style = "background-color: red">

CSS Example: table background color

In our CSS tutorial you can find more information about the background-color attribute details.


grammar

<table bgcolor="color_name|hex_number|rgb_number">

Property Value

描述
color_name 规定颜色值为颜色名称的背景颜色(比如 "red")。
hex_number 规定颜色值为十六进制值的背景颜色(比如 "#ff0000")。
rgb_number 规定颜色值为 rgb 代码的背景颜色(比如 "rgb(255,0,0)")。


HTML table tag Reference Manual HTML <table> tag