示例工程 21-data-report

21-data-report/demo-02-table/index.html

html · 2.4 KB

运行:报告数据表演示

点击「运行示例」后,左侧显示源码、右侧显示运行结果;console 输出会实时回传。

<!doctype html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>报告数据表演示</title>
    <style>
      body { margin: 0; padding: 32px; background: #f8fafc; color: #0f172a; font-family: system-ui, sans-serif; line-height: 1.7; }
      .box { max-width: 760px; margin-bottom: 16px; padding: 18px; border: 1px solid #e2e8f0; border-radius: 12px; background: #fff; }
      h1 { margin: 0 0 16px; font-size: 28px; }
      h2 { margin: 0 0 8px; font-size: 17px; }
      p { margin: 0 0 10px; color: #334155; }
      table { width: 100%; border-collapse: collapse; font-size: 14px; }
      caption { padding: 6px 8px; text-align: left; color: #475569; font-size: 13px; }
      th, td { padding: 8px 10px; border-bottom: 1px solid #e2e8f0; text-align: left; }
      thead th { background: #f1f5f9; }
      tbody th { background: #f8fafc; }
      td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
      tfoot th, tfoot td { background: #f8fafc; font-weight: 600; border-top: 2px solid #cbd5e1; }
      a { color: #2563eb; }
    </style>
  </head>
  <body>
    <h1>报告数据表</h1>

    <div class="box">
      <h2>明细与合计</h2>
      <table>
        <caption>2026 年 Q1–Q3 运营数据</caption>
        <thead>
          <tr>
            <th scope="col">季度</th>
            <th scope="col" class="num">访问量</th>
            <th scope="col" class="num">注册数</th>
            <th scope="col" class="num">转化数</th>
          </tr>
        </thead>
        <tbody>
          <tr><th scope="row">Q1</th><td class="num">12,000</td><td class="num">1,200</td><td class="num">360</td></tr>
          <tr><th scope="row">Q2</th><td class="num">15,000</td><td class="num">1,500</td><td class="num">450</td></tr>
          <tr><th scope="row">Q3</th><td class="num">18,000</td><td class="num">1,800</td><td class="num">540</td></tr>
        </tbody>
        <tfoot>
          <tr><th scope="row">合计</th><td class="num">45,000</td><td class="num">4,500</td><td class="num">1,350</td></tr>
        </tfoot>
      </table>
    </div>

    <div class="box">
      <h2>来源与下载</h2>
      <p>数据来源:运营后台导出,更新于 <time datetime="2026-11-28">2026-11-28</time>。</p>
      <p><a href="assets/data.csv" download="2026-q1-q3-report.csv">下载 CSV</a></p>
    </div>
  </body>
</html>