HTML <th>标签的bgcolor属性

HTML <th>标签参考手册 HTML <th>标签

示例

一个具有背景色的表头单元格:

<table border="1">
  <tr>
    <th bgcolor="#FF0000">月份</th>
    <th bgcolor="#00FF00">存款</th>
  </tr>
  <tr>
    <td>一月</td>
    <td>100</td>
  </tr>
</table>

试一个 »

定义及用法

<th>标签的bgcolor属性用于设置表头单元格的背景颜色。


浏览器支持

Internet Explorer Firefox Opera Google Chrome Safari

虽然<th>标签的bgcolor属性已被弃用,但所有主流浏览器仍然支持它。


兼容性提示

<th>标签的bgcolor属性已被弃用,HTML 4.01 Strict和XHTML 1.0 Strict DTD均不支持此属性。

请用CSS作为替代。

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

CSS示例:表头单元格的背景色

在我们的CSS教程中,你可以找到有关background-color属性的更多信息。


语法

<th bgcolor="value">

属性值

描述
颜色名 用颜色名来指定背景颜色(如“red”)
十六进制颜色值 用十六进制代码来指定背景颜色(如“#ff0000”)
RGB颜色值 用RGB代码来指定背景颜色(如“rgb(255,0,0)”)


HTML <th>标签参考手册 HTML <th>标签
粤ICP备11097351号-1