博主信息
博文 13
粉丝 0
评论 0
访问量 6564
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
第七节课html标签元素属性作业-2019-9-6 作业
鹰弘网络科技的博客
原创
727人浏览过

老师,这个表格我在网上查了,说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举报处理!
全部评论 文明上网理性发言,请遵守新闻评论服务协议
0条评论
作者最新博文
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号

  • 登录PHP中文网,和优秀的人一起学习!
    全站2000+教程免费学