好嘞!我把“文章一览(表格)”做成一个独立组件,样式外链到 styles/,运行效果对齐你给的截图(表头+斑马纹+标题为蓝色可点、右侧分类/日期)。
styles/article-list.css(见下文)。article-list.html(见下文)。post-datail-flex.htmlpost-datail-10min.html
第 3、4 行你可先用 # 占位,之后再换成别的详情页。article-list.html<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>文章一览(表格示例)</title>
<link rel="stylesheet" href="styles/article-list.css" />
</head>
<body>
<main class="wrap">
<h2 class="block-title">文章一览(表格示例)</h2>
<section id="post-table" class="table-wrap">
<table class="post-table">
<colgroup>
<col style="width:80px" />
<col />
<col style="width:140px" />
<col style="width:160px" />
</colgroup>
<thead>
<tr>
<th>编号</th>
<th>标题</th>
<th>分类</th>
<th>发布日期</th>
</tr>
</thead>
<tbody>
<tr>
<td class="no">1</td>
<td class="title">
<a href="post-datail-flex.html">从“能看网页”到“能做网页”</a>
</td>
<td class="cat">入门</td>
<td class="date">2024-10-01</td>
</tr>
<tr>
<td class="no">2</td>
<td class="title">
<a href="post-datail-10min.html">从毛坯房到“能家”:用三剑客读懂网页的魔法</a>
</td>
<td class="cat">入门</td>
<td class="date">2024-11-12</td>
</tr>
<tr>
<td class="no">3</td>
<td class="title">
<a href="#">从有意思到有意义</a>
</td>
<td class="cat">分享</td>
<td class="date">2025-08-17</td>
</tr>
<tr>
<td class="no">4</td>
<td class="title">
<a href="#">Web 前端技术:无处不在的数字魔法</a>
</td>
<td class="cat">入门</td>
<td class="date">2025-08-20</td>
</tr>
</tbody>
</table>
</section>
</main>
</body>
</html>
styles/article-list.css:root{
--text:#0f172a;
--muted:#475569;
--link:#2563eb;
--line:#e5e7eb;
--row:#f3f4f6; /* 斑马纹行色 */
}
*{ box-sizing:border-box; }
body{
margin:0;
font-family:system-ui,-apple-system,"Segoe UI",Roboto,"PingFang SC","Microsoft YaHei",sans-serif;
color:var(--text);
background:#fff;
}
.wrap{ max-width:1080px; margin:0 auto; padding:24px; }
.block-title{ font-size:20px; margin:8px 0 16px; }
.table-wrap{ overflow-x:auto; background:#fff; border-radius:10px; }
.post-table{
width:100%;
border-collapse:separate;
border-spacing:0;
font-size:16px;
}
.post-table thead th{
text-align:left;
color:var(--muted);
font-weight:600;
padding:12px 16px;
border-bottom:1px solid var(--line);
}
.post-table tbody td{
padding:14px 16px;
border-bottom:1px solid var(--line);
vertical-align:middle;
}
/* 斑马纹 + 行 hover */
.post-table tbody tr:nth-child(even){ background:var(--row); }
.post-table tbody tr:hover{ filter:brightness(0.98); }
/* 各列细化 */
.no{ font-weight:700; font-size:18px; color:var(--text); }
.title a{ color:var(--link); text-decoration:none; }
.title a:hover{ text-decoration:underline; }
/* 小屏优化:适度缩小字号与内边距 */
@media (max-width:600px){
.post-table{ font-size:15px; }
.post-table thead th, .post-table tbody td{ padding:10px 12px; }
}
如果你要把它放到现有页面(比如 index.html 或 article-cards.html)里,只需:
在 <head> 引入:
<link rel="stylesheet" href="styles/article-list.css">
在合适位置粘贴 <section id="post-table" …>…</section> 这一段即可(保留 h2 看你需要)。
.no{ font-size:20px; }。