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