html——table标签及其css样式

<table border="1" width="400px" height="200px">
    <caption>完整table</caption> //标题
    <thead>
    <tr>
        <th></th>
        <th></th>
    </tr>
    </thead>
    <tbody>
    <tr>
        <td></td>
        <td></td>
    </tr>
    </tbody>
    <tfoot>
    <tr>
        <td colspan="2">底部</td> //横向合并
    </tr>
    </tfoot>
</table>

css样式:

  • width height——仅table和td使用
  • align水平对齐——table+tr+td
  • valign垂直对齐——tr+td
  • cellpadding cellspacing内外边距——table

注:thead/tbody/tfoot是不可见元素 无法给它们设置属性

细线表格:
table{ background-color: black; }
tr{ background-color: white; }

另外table加上 cellspacing='1'

若指定了 thead 和 tfoot,则其有默认高度 不随 table 设置高度改变
rowspan 和 colspan 只是向下和向后合并

去除表格间隙:
table {
  border-collapse: collapse;
}
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值