table 属性和标签

本文详细介绍了HTML中表格的各种属性及用法,包括border、frame、cellpadding和cellspacing等,并展示了如何使用这些属性来定制表格的外观。

常用属性:

border:设置外围框的大小。

frame:设置边框的显示方式(枚举选项)。

Cell padding :设置cell内容与边框之间空白的大小。(内补丁)

Cell spacing :设置cell边框的大小。

cellpadding="10"Row
SecondRow

cellspacing="10"Row
SecondRow

 

表格标签

表格描述
<table>定义表格
<caption>定义表格标题。
<th>定义表格的表头。
<tr>定义表格的行。
<td>定义表格单元。
<thead>定义表格的页眉。
<tbody>定义表格的主体。
<tfoot>定义表格的页脚。
<col>定义用于表格列的属性。
<colgroup>

定义表格列的组。配合<col>可分组定义column的样式。

        

        <table border="1" frame="box" cellpadding="5" cellspacing="5">
            <caption>
                this is caption</caption>
            <colgroup>
                <!--下面的表格未必能体现出来,IE可以很好地支持,FF不支持color-->
                <col style="width: 50px; color: Red" />
                <col style="width: 80px; color: Blue;" />
                <col style="width: 110px; color: Gray;" />
                <col style="width: 150px; color: Green;" />
            </colgroup>
            <tfoot>
                <tr>
                    <td colspan="4">
                        this is tfoot
                    </td>
                </tr>
            </tfoot>
            <thead>
                <tr>
                    <th>
                        thead
                    </th>
                    <th>
                        thead
                    </th>
                    <th>
                        thead
                    </th>
                    <th>
                        thead
                    </th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>
                        tbody1
                    </td>
                    <td>
                        tbody2
                    </td>
                    <td>
                        tbody3
                    </td>
                    <td rowspan="2">
                        tbody4
                    </td>
                </tr>
                <tr>
                    <td>
                        tbody1
                    </td>
                    <td>
                        tbody2
                    </td>
                    <td>
                        tbody3
                    </td>
                </tr>
            </tbody>
        </table>

this is caption
this is tfoot
thead thead thead thead
tbody1 tbody2 tbody3 tbody4
tbody1 tbody2 tbody3
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值