示例工程 10-links

10-links/demo-02-anchors-download/index.html

html · 1.5 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.75; }
      .box { max-width: 720px; margin-bottom: 16px; padding: 18px; border: 1px solid #e2e8f0; border-radius: 12px; background: #fff; }
      h1 { margin: 0 0 16px; font-size: 28px; }
      h2 { margin: 18px 0 8px; font-size: 17px; }
      p { margin: 0 0 10px; color: #334155; }
      a { color: #2563eb; }
      nav a + a { margin-left: 12px; }
    </style>
  </head>
  <body>
    <h1>锚点与下载</h1>

    <div class="box">
      <h2>页内导航</h2>
      <nav aria-label="页内导航">
        <a href="#install">安装</a>
        <a href="#usage">使用</a>
        <a href="#faq">常见问题</a>
      </nav>
    </div>

    <div class="box">
      <h2 id="install">安装</h2>
      <p>下载后解压,双击打开。</p>
    </div>

    <div class="box">
      <h2 id="usage">使用</h2>
      <p>按向导完成三步配置。</p>
    </div>

    <div class="box">
      <h2 id="faq">常见问题</h2>
      <p>打不开时先检查路径与文件权限。</p>
    </div>

    <div class="box">
      <h2>下载与联系</h2>
      <p><a href="assets/checklist.txt" download="checklist.txt">下载清单</a></p>
      <p><a href="mailto:hi@example.com?subject=锚点问题">发邮件询问</a></p>
    </div>
  </body>
</html>