html表格

<table>:表格创建

<tr>:一行的创建

<th>:一个题头

<td>:一个普通单元格

注意:td元素中一定要非空,不然不能显示背景色。

通常组织形式如下

<table>

<tr>

<th></th>

<td></td>

</tr>

</table>

下面介绍<table>的常用属性:

(1)align:可选left\center\right,表明左对齐、右对齐、中间对齐。

(2)bgcolor:背景颜色,可选red\blue等常用颜色。

(3)border:默认表是没边框的,因此这个是创建边框。

(4)cellpadding:单元格的边和实际文本的间隔。

(5)cellspacing:单元格之间的间隙。

下面是<tr>的常用属性:

(1)align:left、center、right。默认<td>左对齐,<th>中对齐

(2)bgcolor:背景色

下面是<td>和<th>的常用属性:

(1)abbr:提供单元格的缩写版本。

(2)bgcolor

(3)colspan:一个单元格跨越的列的数量。

(4)nowrap:阻止文本换行。nowrap = "nowrap"

(5)rowspan:跨越行的数量。


<html>  
    <head><title>Home</title></head>  
    <body>  
        <table cellspacing = "2">  
            <tr bgcolor = "orange">  
                <th></th>  
                <th>Saturday</th>  
                <th>Sunday</th>  
            </tr>  
            <tr>  
                <th bgcolor = "orange">Morning</th>  
                <td>Hello world</td>  
                <td>Hello world</td>  
            </tr>  
            <tr>  
                <th bgcolor = "orange">Afternoon</th>  
                <td>Hello world</td>  
                <td>Hello world</td>  
            </tr>  
        </table>  
    </body>  
</html>  

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值