【Web应用技术基础】CSS(5)——表格样式

第一题:表格边框

.html

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <title>HTML – 简单表格</title>
        <link rel="stylesheet" href="step1/CSS/style.css">
    </head>

    <body>
        <table>
            <caption>彩排安排</caption>
            <thead>
                <!-- 表格头部 -->
                <tr>
                    <th scope="rowgroup">时间</th>
                    <th scope="col">周一</th>
                    <th scope="col">周二</th>
                    <th scope="col">周三</th>
                </tr>
            </thead>
            <tbody>
                <!-- 表格主体 -->
                <tr>
                    <th scope="row">上午8点</th>
                    <td>开场舞</td>
                    <td colspan="2">歌曲串烧</td>
                </tr>
                <tr>
                    <th scope="row">上午9点</th>
                    <td>小品</td>
                    <td>相声</td>
                    <td rowspan="2">大型魔术</td>
                </tr>
                <tr>
                    <th scope="row">上午10点</th>
                    <td>杂艺表演</td>
                    <td>乐队歌曲</td>
                </tr>
            </tbody>
        </table>
    </body>
</html>

.css

table {
    /* ********** BEGIN ********** */
    border-collapse: collapse; /*设置折叠边框*/
    border: 2px solid black;
    
    /* ********** END ********** */
}

th,
td {
    padding: .5em .75em;
}

th {
    /* ********** BEGIN ********** */
     border: 1px solid grey;
    /* ********** END ********** */
}

td {
    /* ********** BEGIN ********** */
    border: 1px dotted grey;
    /* ********** END ********** */
}

第二题:表格颜色、文字与大小

.html

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <title>HTML – 简单表格</title>
        <link rel="stylesheet" href="step2/CSS/style.css">
    </head>
    <body>
        <table>
            <caption>彩排安排</caption>
            <thead>
                <!-- 表格头部 -->
                <tr>
                    <th scope="rowgroup">时间</th>
                    <th scope="col">周一</th>
                    <th scope="col">周二</th>
                    <th scope="col">周三</th>
                    <th scope="col">周四</th>
                </tr>
            </thead>
            <tbody>
                <!-- 表格主体 -->
                <tr>
                    <th scope="row">上午8点</th>
                    <td>开场舞</td>
                    <td colspan="3">歌曲串烧</td>
                </tr>
                <tr>
                    <th scope="row">上午9点</th>
                    <td>小品</td>
                    <td>相声</td>
                    <td rowspan="2">大型魔术</td>
                    <td>乐队歌曲</td>
                    
                </tr>
                <tr>
                    <th scope="row">上午10点</th>
                    <td>杂艺表演</td>
                    <td>乐队歌曲</td>
                    <td>杂艺表演</td>
                    
                </tr>
                <tr>
                    <th scope="row">上午8点</th>
                    <td>开场舞</td>
                    <td>歌曲串烧</td>
                    <td>小品</td>
                    <td>相声</td>
                </tr>
            </tbody>
        </table>
    </body>
</html>

.css

table {
    border-collapse: collapse;
    border: 2px solid black;
}

caption {
    /* ********** BEGIN ********** */
    font-size: 20px;
    font-weight: bold;
    height: 40px;



    /* ********** END ********** */
}

th,
td {
    /* ********** BEGIN ********** */
    height: 50px;
    width: 100px;
    text-align: center;
    /* ********** END ********** */
}

th {
    /* ********** BEGIN ********** */
    border: 1px solid white;
    background-color: lightseagreen;
    color: white;

    /* ********** END ********** */
}

td {
    border: 1px solid grey;
}

相关推荐

  1. Web应用技术基础CSS(3)——文本与文字样式

    2024-03-29 08:46:02       17 阅读
  2. CSS基础样式

    2024-03-29 08:46:02       7 阅读
  3. CSS基础——1.CSS样式

    2024-03-29 08:46:02       15 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-03-29 08:46:02       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-03-29 08:46:02       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-03-29 08:46:02       18 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-03-29 08:46:02       20 阅读

热门阅读

  1. 前端基础复习--HTML篇

    2024-03-29 08:46:02       20 阅读
  2. Linux查询|搜索|过滤|文本日志命令汇总

    2024-03-29 08:46:02       19 阅读
  3. 篇四.软件测试管理办法

    2024-03-29 08:46:02       18 阅读
  4. linux: du用法详解

    2024-03-29 08:46:02       16 阅读
  5. c++ 的左值和右值如何理解

    2024-03-29 08:46:02       16 阅读
  6. C#WPF的XAML命名空间和命名空间映射详解

    2024-03-29 08:46:02       23 阅读
  7. C# Stopwatch 计时器

    2024-03-29 08:46:02       20 阅读
  8. Docker搭建MinIO

    2024-03-29 08:46:02       20 阅读
  9. 使用Python进行双色球选号

    2024-03-29 08:46:02       15 阅读
  10. VOS 3000外呼系统中接通率与应答率的区别

    2024-03-29 08:46:02       16 阅读
  11. python爬虫----python列表高级

    2024-03-29 08:46:02       18 阅读
  12. LeetCode-热题100:560. 和为 K 的子数组

    2024-03-29 08:46:02       18 阅读
  13. idea默认代码生成脚本修改

    2024-03-29 08:46:02       18 阅读