Latest web development tutorials

HTML th bgcolor attribute

HTML th tag Reference Manual HTML <th> tag

Examples

Table header cell to add a background color:

<table border="1">
<tr>
<th bgcolor="#FF0000">Month</th>
<th bgcolor="#00FF00">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 <th> bgcolor attribute. Use CSS instead.

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

bgcolor attribute specifies the background color of the header cell.


Compatibility Notes

In HTML 4.01, <th> the bgcolor attribute obsolete. Use CSS instead.

CSS Syntax: <th style = "background-color: red">

CSS Example: to add a header cell background color

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


grammar

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

Property Value

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


HTML th tag Reference Manual HTML <th> tag