table的 cellspacing 本质是 border-spacing

来源:互联网 发布:河南中小学生消防知 编辑:程序博客网 时间:2024/06/05 00:19

table的 cellspacing  本质是 border-spacing


border-spacing 学习:

1.border-spacing 只能用在table (或者display table 的元素上,会作用于 子元素上)

2.border-spacing 只有在 border-collapse 不是  collapse  (是separate)的时候有效

3. 可以分别设置垂直和水平的值    如果定义两个 length 参数,那么第一个设置水平间距,而第二个设置垂直间距。

-webkit-border-vertical-spacing: 10px;
-webkit-border-horizontal-spacing:120px;






<!DOCTYPE html>

<html>
<head>
    <title></title>
    <meta charset="gbk">
    <style type="text/css">
        table {
            border: 1px solid green;
        }
    </style>
</head>
<body>
<table cellspacing="7" id="test">
    <tr>
        <th>第一</th>
        <th>第二</th>
        <th>第三</th>
    </tr>
    <tr>
        <td>
            第一内容
        </td>
        <td>
            第二内容
        </td>
        <td>
            第三内容
        </td>
    </tr>
</table>
</body>
<script type="text/javascript">
alert(window.getComputedStyle(document.getElementById("test")).getPropertyValue("border-spacing"));
</script>
</html>
0 0
原创粉丝点击