登录  /  注册
博主信息
博文 18
粉丝 0
评论 0
访问量 19683
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
使用CSS制作一张带有四个圆角的表格
葛佬的博客
原创
591人浏览过

使用CSS制作一张带有四个圆角的表格

实例

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <style>
      /*给表格加上边框*/
table {
    border: 1px solid #444444;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 12px;
}

th, td {
    border: 1px solid #444444;
}

/*设置表格的宽度与文本*/
table {
    width: 800px;
    margin: 20px auto;
}

/*设置单元格的样式*/
th, td {
    text-align: center;
    padding: 10px;
}

table caption {
    font-size: 1.3rem;
    font-weight: bolder;
    margin-bottom: 15px;
}

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

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

table tbody > tr:nth-last-of-type(3) > td:first-of-type {
    background-color: lightcyan;
}

table tbody > tr:nth-last-of-type(3) {
    background-color: lightblue;
}

table tbody > tr:nth-last-of-type(1){
    background-color: lightgray;
}

table th:first-child{
    border-radius: 12px 0 0 0;
}
table th:last-child{
    border-radius: 0 12px 0 0;
}
table tr:last-child td:first-child{
    border-radius: 0 0 0 12px;
}
table tr:last-child td:last-child{
    border-radius: 0 0 12px 0;
}
    </style>
    <title>css控制表格的样式</title>
</head>
<body>
<table>
<!--    标题-->
    <caption>合肥科大附小一年级(三班)课程表</caption>
<!--    表头-->
    <thead>
    <tr>
        <th>星期</th>
        <th>星期一</th>
        <th>星期二</th>
        <th>星期三</th>
        <th>星期四</th>
        <th>星期五</th>
    </tr>
    </thead>
<!--    主体-->
    <tbody>
    <tr>
        <td rowspan="3">上午<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 rowspan="2">下午<br>13:30 - 15: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 colspan="5">周未家长必须来学校帮助孩子打扫卫生</td>
    </tr>
    </tbody>
</table>
</body>
</html>

运行实例 »

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

 

批改状态:合格

老师批语:你考验老师的大脑运行吗? 应该配一个图, 再直观些
本博文版权归博主所有,转载请注明地址!如有侵权、违法,请联系admin@php.cn举报处理!
全部评论 文明上网理性发言,请遵守新闻评论服务协议
0条评论
作者最新博文
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

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

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