6、css学习6(表格)

1、指定CSS表格边框,使用border属性。

2、表格双边框是因为th/td有各自独立的边框。

3、boder-collapse设置表格边框是否被折叠成一个单一的边框。

4、width和height属性定义表格的宽度和高度。

5、text-align属性设置水平对齐方式。

6、vertic-align属性设置垂直对齐方式。

7、padding填充属性用来控制边框与内容之间的距离。

8、background-color、color分别设置背景颜色与文本颜色。

9、用caption属性定义表格名称。

<!DOCTYPE html>
<html>
    <head>
        <meta charset="uft-8">
        <title>CSS修饰表格</title>
        <style>
            table,th,td{
                border: 1px solid blue;
                border-collapse: collapse;
            }
            th{
                height: 50px;
                background-color: bisque;
            }
            td{
                text-align: center;
                vertical-align: bottom;
                padding: 15px;
                color: green;
            }
            caption {caption-side: bottom;color:red}
        </style>
    </head>
    <body>
        <table>
            <tr>
                <th>名称</th>
                <th>简介</th>
            </tr>
            <tr>
                <td>php</td>
                <td>世界上最好的编程语言</td>
            </tr>
            <tr>
                <td>java</td>
                <td>也很强</td>
            </tr>
            <caption>表1:世界著名编程语言比较</caption>
        </table>
    </body>
</html>

运行结果:

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值