HTML table bgcolor 屬性
實例
帶有背景顏色的HTML 表格:
<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>
嘗試一下»
瀏覽器支持
所有主流瀏覽器都支持bgcolor 屬性。
定義和用法
HTML5不支持<table> bgcolor屬性。 請使用CSS代替。
在HTML 4.01中,<table>的bgcolor屬性已廢棄 。
bgcolor屬性規定表格的背景顏色。
兼容性註釋
在HTML 4.01 中,<table> 的bgcolor 屬性已廢棄,請使用CSS 代替。
CSS 語法:<table style="background-color:red">
在我們的CSS教程中,您可以找到更多有關background-color屬性的細節。
語法
<table bgcolor="color_name|hex_number|rgb_number">
屬性值
值 | 描述 |
---|---|
color_name | 规定颜色值为颜色名称的背景颜色(比如 "red")。 |
hex_number | 规定颜色值为十六进制值的背景颜色(比如 "#ff0000")。 |
rgb_number | 规定颜色值为 rgb 代码的背景颜色(比如 "rgb(255,0,0)")。 |
HTML <table>標籤