HTML——表头标签<th>的属性

    <th>标签的属性和<td>标签的属性及语法格式非常的相似,用于设定表格中某一表头的属性。


<th>标签中常用的属性
标签 描述
align 设置单元格内容的水平对齐方式
valign 设置单元格内容的垂直对齐方式
bgcolor 设置单元格的背景颜色
background 设置单元格的背景图片
width 设置单元格的宽度
height 设置单元格的高度
rowspan 设置单元格的水平跨度
colspan 设置单元格的垂直跨度

【例】 创建一个表格在其中加入<th>标签添加表头

<!doctype  html>
<html>
<head>
    <meta charset="utf-8">
    <title>这是一个网页</title>
</head>
<body>
<table  border=5  bordercolor="red"  align="center"  bgcolor="ABCDEF" >
    <caption>书单</caption>
    <tr  align=center>
        <th   colspan="3" height="40" background="timg.jpg">文学类</th>
    </tr>
    <tr  align=center>
        <td rowspan="2"  width="40">如丧</td>
        <td  width="150">作者:</td>
        <td>高晓松</td>
    </tr>
    <tr  align=center>

        <td>出版社:</td>
        <td>武汉出版社</td>
    </tr>
</table>
</body>
</html>

结果:



猜你喜欢

转载自blog.csdn.net/qq_41573234/article/details/80140247
今日推荐