HTML table bgcolor attribute
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>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
</table>
try it"
Browser Support
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