HTML tr bgcolor attribute
Examples
To the first table row add a background color:
<table border="1">
<tr bgcolor="#FF0000">
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
</table>
<tr bgcolor="#FF0000">
<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 <tr> bgcolor attribute. Use CSS instead.
In HTML 4.01, <tr> the bgcolor attribute obsolete .
bgcolor attribute specifies the background color of the table rows.
Compatibility Notes
In HTML 4.01, <tr> the bgcolor attribute obsolete. Use CSS instead.
CSS Syntax: <tr style = "background-color: red">
CSS Example: Add a background color to table row
In our CSS tutorial you can find more information about the background-color attribute details.
grammar
<tr bgcolor="color_name|hex_number|rgb_number">
Property Value
值 | 描述 |
---|---|
color_name | 规定颜色值为颜色名称的背景颜色(比如 "red")。 |
hex_number | 规定颜色值为十六进制值的背景颜色(比如 "#ff0000")。 |
rgb_number | 规定颜色值为 rgb 代码的背景颜色(比如 "rgb(255,0,0)")。 |
HTML <tr> tag