HTML5 table表格合併單元格和合並邊框

原文地址和代碼:

原文地址

轉載請備註

代碼:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>合併單元格</title>
    <style>
        table,
        table tr th,
        table tr td {
            border: 1px solid #000000;
            margin: 0;
            padding: 50px;
            /* 合併邊框 */
            border-collapse: collapse;
        }
    </style>
</head>
<body>
    <div>
        <table>
            <caption>食物鏈頂端</caption>
            <tr>
                <th>水果</th>
                <th>蔬菜</th>
                <th>肉類</th>
            </tr>
            <tr>
                <td colspan="2">蘋果</td>
                <td>菠菜</td>
            </tr>
            <tr>
                <td>橙子</td>
                <td rowspan="2">菜花</td>
                <td>牛肉</td>
            </tr>
            <tr>
                <td>香梨</td>
                <td>羊肉</td>
            </tr>
        </table>
    </div>

</body>

</html>

效果:

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章