HTML中有关表格的基本属性知识

表格在网页编程中使用非常的广泛,而且也非常的重要,下面我就将本人编程中所总结的有关表格的基本属性整理处理。


 

 

table标签的基本属性如下:

border:可以的取值为1和0,1代表有边框,0代表没有边框。

bordercolor:可以设置边框的颜色,值为颜色值。

bgcolor:设置表格的背景颜色

background:设置背景图片


 

tr:表示表格中的行标记,属性有align:左中右三个值

td:列标记,align属性可以设置内容的位置

th:是第一行的标题

valign属性可以设置th和td,可以取值Top或者Bottom。

callpadding:内容与单元格边框的间距

cellspacing:防止文本超出边框

如果要使单元格实现跨行或者跨列功能,使用属性colspan和rowspan.


 

实例代码:

<body>
    <table border="1" bordercolor="red" bgcolor="#ff4646">
        <caption>表格示例</caption>
        <tr align="center">
            <th>标题1</th>
            <th>标题2</th>
            <th>标题3</th>
        </tr>
        <tr>
            <td align="left">左</td>
            <td align="center">中</td>
            <td align="right">右</td>
        </tr>
        <tr>
            <td valign="top">top</td>
            <td>center</td>
            <td valign="bottom">bottom</td>
        </tr>
    </table>
</body>

  


 

单元格跨行

<table border="1" bordercolor="#1f1fff">
        <caption>单元格的跨行</caption>
        <tr>
            <th>姓名</th>
            <th colspan="2">电话</th>
        </tr>
        <tr>
            <td>东腾</td>
            <td>1301485237 1067225098</td>
        </tr>
    </table>

  


 

单元格跨列

<table border="1">
        <caption>单元格跨列</caption>
        <tr>
            <th>姓名</th>
            <th>电话</th>
        </tr>
        <tr>
            <td rowspan="2">东腾</td>
            <td>1301485237</td>
        </tr>
        <tr>
            
            <td>1067225098</td>
        </tr>
    </table>

  

不足之处,还望指点!!!

 

转载于:https://my.oschina.net/dongteng/blog/684367

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值