HTML:表格数据展示区

html 复制代码
<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>人员信息表</title>
    <link rel="stylesheet" href="styles.css">
</head>

<body>
    
    <table>
        <thead>
             <!-- thead 表示表格中的表头 -->
            
            <tr>
                <!-- tr 表示表格中的行 ,一个tr就是一行-->
                <!-- th 表示表格中的表头单元格,会加粗 -->
                <th>姓名</th>
                <th>年龄</th>
                <th>职位</th>
                <th>头像</th>
                <th>入职日期</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>张三</td>
                <!-- td 表示表格中的单元格 -->
                <td>25</td>
                <td>前端开发</td>
                <td><img src="CSS//img/1.png" alt="Avatar" width="50"></td>
                <td>2023-01-01</td>
                <td>
                    <!-- 这里删除按钮无法实现动态删除功能,仅作展示 -->
                    <button>删除</button>
                    <button>添加</button>
                    <!-- 文字居中 -->
                   
                           
                     
                </td>
            </tr>
            <tr>
                <td>李四</td>
                <td>30</td>
                <td>后端开发</td>
                <td><img src="CSS//img/1.png" alt="Avatar" width="50"></td>
                <td>2022-05-15</td>
                <td>
                    <button>删除</button>
                    <button>添加</button>
                </td>
            </tr>
           
        </tbody>
    </table>
</body>

<body>
    <!-- 页面主体内容 -->
    <footer>
        <p>北京大学</p>
        <p>邮箱:pku@edu.cn  电话:010 - 12345678</p>
    </footer>
</body>
</html>
复制代码
body {
    font-family: Arial, sans-serif;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

th,
td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

th {
    background-color: #f2f2f2;
}

button {
    padding: 5px 10px;
    background-color: #4CAF50;
    color: white;
    border: none;
    cursor: pointer;
}

button:hover {
    background-color: #45a049;
}

footer {
    /* 设置背景色为灰色,这里使用十六进制颜色码 #808080,你也可以根据喜好调整 */
    background-color: #808080; 
    /* 上下内边距为 20px,左右内边距为 0 */
    padding: 20px 0; 
    /* 文本居中显示 */
    text-align: center; 
    /* 让 footer 固定在页面底部(如果有需要),可根据实际情况调整 */
    width: 100%; 
}

footer p {
    /* 上下外边距为 5px,左右外边距为 0 */
    margin: 5px 0; 
    /* 字体颜色为白色,和灰色背景形成对比 */
    color: white; 
    /* 字体大小为 14px */
    font-size: 14px; 
}
相关推荐
用户62960593247052 小时前
从“浏览器根本区分不了”到真正实现:刷新不退出,关闭标签页自动退出,前端判断浏览器关闭和刷新
前端
qetfw2 小时前
MWU:Vue 3 + FastAPI 的 MaaFramework 跨平台 WebUI 源码
前端·vue.js·python·fastapi·开源项目·效率工具
mfxcyh2 小时前
Vue3+Ant Design Vue 实现手动异步文件上传(含大小校验、弹窗上传)
前端·javascript·vue.js
wordbaby2 小时前
Web端热敏标签打印完整解决方案(QZ Tray + 译维A42)
前端
swipe2 小时前
03|Axios 请求进了后端之后:Controller、Request、Response 是怎么接住它的?
前端·后端·全栈
meilindehuzi_a2 小时前
Vue3进阶基础:指令修饰符、v-model表单绑定、动态样式、计算属性与侦听器实战
前端·javascript·vue.js
csdn2015_3 小时前
vue 前端运行命令
前端·javascript·vue.js
swipe3 小时前
02|从 `pnpm dev` 到 Spring Boot 启动:后端服务到底怎么跑起来?
前端·后端·全栈
swipe3 小时前
01|前端人第一次打开 Spring Boot 项目,应该先看哪里?
前端·后端·全栈
Cobyte3 小时前
根据浏览器解析 HTML 的规范实现 HTML 解析器
前端·javascript·vue.js