博客列表 >表格css美化--2019年9月6日 20点

表格css美化--2019年9月6日 20点

cat的博客
cat的博客原创
2019年09月08日 16:04:36630浏览

实例

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>表格</title>
    <style>
        table {
            width: 600px;
            margin: 10px auto;
            border: solid 1px #333;
            /*-webkit-border-radius: 15px;*/
            /*-moz-border-radius: 15px;*/
            border-collapse: collapse;
        }
        table caption {
            margin-bottom: 10px;
            font-weight: bolder;
            font-size: 1.2rem;
        }
        th, td {
            border: solid 1px #333;
            text-align: center;
            padding: 10px;
        }
        table>thead:nth-of-type(1) {
            background-color: lightgreen;
        }
        table tbody>tr:first-of-type>td:first-of-type {
            background-color: lightcoral;
        }
        table tbody>tr:nth-of-type(4)>td:first-of-type {
            background-color: blueviolet;
        }
        table tfoot>tr:first-child {
            background-color: #ccc;
        }
    </style>
</head>
<body>
    <table>
        <caption>学生课程表</caption>
        <thead>
            <th>星期</th>
            <th>星期一</th>
            <th>星期二</th>
            <th>星期三</th>
            <th>星期四</th>
            <th>星期四</th>
        </thead>
        <tbody>
            <tr>
                <td rowspan="3">上午 8:00-11:00</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">下午 3:00-5:00</td>
                <td>语文</td>
                <td>数学</td>
                <td>美术</td>
                <td>体育</td>
                <td>音乐</td>
            </tr>
            <tr>
                <td>语文</td>
                <td>数学</td>
                <td>美术</td>
                <td>体育</td>
                <td>音乐</td>
            </tr>
        </tbody>
        <tfoot>
            <tr>
                <td>备注:</td>
                <td colspan="5">放学打扫卫生</td>
            </tr>
        </tfoot>
    </table>
</body>
</html>

运行实例 »

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


效果如下图

D@%3L4@BFE{5)}(2HN%G__B.png

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