博客列表 >第七节课html标签元素属性作业-2019-9-6 作业

第七节课html标签元素属性作业-2019-9-6 作业

鹰弘网络科技的博客
鹰弘网络科技的博客原创
2019年09月08日 21:30:07594浏览

老师,这个表格我在网上查了,说table的border-collapse:collapse与 border-radius不兼容。可是想了很久以后,不知道为什么,我表格有个列的左边框为什么不显示呢?

1.jpg

实例

<!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">
    <link rel="stylesheet" href="zy.css">
    <title>2019最新课程表</title>
    <style>
      table {
    /* border: 1px solid #000; */
    /* border-collapse: collapse; */
    width: 800px;
    margin: 2px auto;
    border-spacing: 0;
    /* box-shadow: 2px 2px 2px #888888; */
}

th,
td {
    /* border: 1px solid #000; */
    text-align: center;
    padding: 10px;
    border-left: 1px solid #000;
    border-top: 1px solid #000;
}

th {
    border-top: none;
}

table caption {
    font-size: 1.3rem;
    font-weight: bolder;
}

table thead>tr:first-of-type {
    background: lightcoral;
}

table tbody>tr:first-of-type>td:first-of-type {
    background: lightgreen;
}

table tbody>tr:nth-last-of-type(2)>td:first-of-type {
    background: lightpink;
}

table tfoot>tr:last-of-type {
    background: lightskyblue;
}

table th:first-of-type,
table td:first-of-type {
    border-left: none;
}

table th:first-of-type {
    border-radius: 10px 0 0 0;
}

table th:last-of-type {
    border-radius: 0 10px 0 0;
}

table tr:last-of-type td:first-of-type {
    border-radius: 0 0 0 10px;
}

table tr:last-of-type td:last-of-type {
    border-radius: 0 0 10px 0;
}
    </style>
</head>

<body>
    <table>
        <caption>
            <h2>课程表</h2>
        </caption>
        <thead>
            <tr>
                <th>星期</th>
                <th>星期一</th>
                <th>星期二</th>
                <th>星期三</th>
                <th>星期四</th>
                <th>星期五</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td rowspan="4">上午<br>8:00-11:30</td>
                <td>语文</td>
                <td>数学</td>
                <td>英语</td>
                <td>历史</td>
                <td>体育</td>
            </tr>
            <tr>
                <td>语文</td>
                <td>数学</td>
                <td>英语</td>
                <td>历史</td>
                <td>体育</td>
            </tr>
            <tr>
                <td>语文</td>
                <td>数学</td>
                <td>英语</td>
                <td>历史</td>
                <td>体育</td>
            </tr>
            <tr>
                <td>语文</td>
                <td>数学</td>
                <td>英语</td>
                <td>历史</td>
                <td>体育</td>
            </tr>
            <tr>
                <td rowspan="2">下午<br>8:00-11:30</td>
                <td>语文</td>
                <td>数学</td>
                <td>英语</td>
                <td>历史</td>
                <td>体育</td>
            </tr>
            <tr>
                <td>语文</td>
                <td>数学</td>
                <td>英语</td>
                <td>历史</td>
                <td>体育</td>
            </tr>
            <tfoot>
                <tr>
                    <td>备注:</td>
                    <td colspan="5">打扫卫生后记得将扫帚归位!</td>
                </tr>
            </tfoot>
        </tbody>
    </table>
</body>

</html>

运行实例 »

点击 "运行实例" 按钮查看在线实例

声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议