原生table的常用属性,border-collapse:collapse,separate,none;cellspacing="10"

版权声明:所有原创文章未经本人同意不得随意转载,谢谢 https://blog.csdn.net/tangcc110/article/details/86031406

原生的table的常用属性:

//有!DOCTYPE表格属性border-collapse才能兼容ie8。

代码如下 :

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>table 的常用属性</title>
    <style type="text/css">
        table{
            border-collapse: collapse; /* 会覆盖 cellspacing*/
        }
        table tr{
            background: red;
        }
        table tr td{
            border:1px solid #dfdfdf;
        }

    </style>
</head>
<body>
    <table cellpadding="10px" cellspacing="20">
        <thead>
            <tr>
                <th>姓名</th>
                <th>爱好</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>周杰轮</td>
                <td>太多了</td>
            </tr>
            <tr>
                <td>昆菱</td>
                <td>喜欢唱歌</td>
            </tr>
        </tbody>
    </table>
    <script type="text/javascript">
    </script>
</body>
</html>

猜你喜欢

转载自blog.csdn.net/tangcc110/article/details/86031406