怎么给表格的边框合并?



```html

    <style>
        th{
            border: 1px solid red;
            width: 100px;
            height: 100px;
        }
        td{
            border: 1px solid red; 
            height: 100px;
            width: 100px; 
        }
        .box1{
            border: 1px solid red;
            width: 100px;
            height: 100px;
            margin-top: 10px;
        }
    </style>
</head>
<body>
    <table  border="1" cellspacing="0">
        <tr>
            <th>姓名</th>
            <th>班级</th>
            <th>年龄</th>
        </tr>
        <tr>
            <td>小李</td>
            <td>高一</td>
            <td>16</td>
        </tr>
        <tr>
            <td>小王</td>
            <td>高二</td>
            <td>17</td>
        </tr>
    </table>
    <div class="box1">

    </div>
</body>
</html>

``表格的边框设置为1 但是cellspacing=0 但是表格的边框并不是为1啊
怎么设置表格的边框为1呢?并且怎么同时给th td 设置样式呢? 尤其是cellspacing和cellpadding怎么在css里面写呢?

【温馨提示:若能帮到你,望给个采纳该答案,谢谢】
1、效果如下
需要给table增加样式:border-collapse: collapse;

img

2、代码如下

<style>
        table { border-collapse: collapse; }
        th { border: 1px solid red; width: 100px; height: 100px; }
        td { border: 1px solid red; height: 100px; width: 100px; }
        .box1 { border: 1px solid red; width: 100px; height: 100px; margin-top: 10px; }
    </style>


    <table border="0" cellspacing="0">
        <tr>
            <th>姓名</th>
            <th>班级</th>
            <th>年龄</th>
        </tr>
        <tr>
            <td>小李</td>
            <td>高一</td>
            <td>16</td>
        </tr>
        <tr>
            <td>小王</td>
            <td>高二</td>
            <td>17</td>
        </tr>
    </table>