示例工程 11-blockquote-cite

11-blockquote-cite/app/index.html

html · 4.6 KB

运行:引用与出处 · blockquote / cite / figure

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

<!doctype html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>引用与出处 · blockquote / cite / figure</title>
    <meta name="description" content="短引用、长引用、署名与 figure 说明的最小示例。" />
    <style>
      * { box-sizing: border-box; }
      body {
        margin: 0;
        min-height: 100vh;
        padding: 32px 20px;
        background: #f8fafc;
        color: #0f172a;
        font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
        line-height: 1.75;
      }
      .page { width: min(100%, 780px); margin: 0 auto; }
      .site-header { display: flex; justify-content: space-between; gap: 16px; padding-bottom: 14px; border-bottom: 1px solid #e2e8f0; }
      .brand { font-weight: 700; letter-spacing: 0.14em; font-size: 13px; }
      nav a { color: #2563eb; font-size: 13px; text-decoration: none; }
      nav a + a { margin-left: 14px; }
      main { padding: 32px 0; }
      .eyebrow { margin: 0; color: #64748b; font-size: 11px; letter-spacing: 0.18em; }
      h1 { margin: 6px 0 12px; font-size: clamp(30px, 6vw, 44px); line-height: 1.15; }
      .lead { margin: 0 0 24px; color: #334155; font-size: 17px; }
      section { margin-top: 28px; padding-top: 20px; border-top: 1px solid #e2e8f0; }
      h2 { margin: 0 0 10px; font-size: 23px; }
      p { margin: 0 0 12px; color: #334155; }
      a { color: #2563eb; }
      code { padding: 1px 5px; border-radius: 4px; background: #f1f5f9; font-family: ui-monospace, Menlo, monospace; font-size: 0.92em; }
      blockquote { margin: 14px 0; padding: 14px 18px; border-left: 4px solid #2563eb; border-radius: 6px; background: #eff6ff; color: #1e3a8a; }
      blockquote p { margin: 0 0 8px; color: inherit; }
      blockquote footer { margin-top: 6px; color: #475569; font-size: 13px; }
      figure { margin: 18px 0; padding: 18px; border: 1px solid #e2e8f0; border-radius: 12px; background: #fff; }
      figure blockquote { margin: 0; }
      figcaption { margin-top: 10px; color: #64748b; font-size: 13px; }
      footer { margin-top: 32px; padding-top: 16px; border-top: 1px solid #e2e8f0; color: #64748b; font-size: 12px; }
      @media (max-width: 560px) {
        .site-header { flex-direction: column; }
        nav a + a { margin-left: 12px; }
      }
    </style>
  </head>
  <body>
    <div class="page">
      <header class="site-header">
        <span class="brand">QUOTE NOTES</span>
        <nav aria-label="页内导航">
          <a href="#short">短引用</a>
          <a href="#long">长引用</a>
          <a href="#figure">图注</a>
        </nav>
      </header>

      <main>
        <p class="eyebrow">LESSON / 11</p>
        <h1>引用与出处</h1>
        <p class="lead">
          引用要分清短句与成段,署名与来源要跟得上。HTML 提供 <code>q</code>、<code>blockquote</code>、<code>cite</code> 与 <code>figure</code>。
        </p>

        <section id="short">
          <h2>1. 短引用</h2>
          <p>规范里写:<q>标题表达层级,不表达字号。</q>短句用 <code>q</code>,浏览器自动加引号。</p>
          <p>不要再手写一层引号,否则会出现双引号。</p>
        </section>

        <section id="long">
          <h2>2. 长引用</h2>
          <p>成段引用用 <code>blockquote</code>,段落放在里面:</p>
          <blockquote cite="source.html">
            <p>标题是文档的骨架。读者扫标题就知道页面讲什么,屏幕阅读器按标题跳转。</p>
            <p>如果标题只用来调字号,这些能力就全部失效。</p>
            <footer>
              —— <cite>HTML 写作规范</cite>,<a href="source.html">来源</a>
            </footer>
          </blockquote>
          <p>引用块用缩进或左边框区分,不要靠斜体大字。</p>
        </section>

        <section id="figure">
          <h2>3. 引用与图注</h2>
          <p>需要把引用与署名作为整体展示时,用 <code>figure</code> 包起来:</p>
          <figure>
            <blockquote cite="source.html">
              <p>结构正确,内容清楚,可访问,才算完成。</p>
            </blockquote>
            <figcaption>
              —— <cite>林小满</cite>,<a href="source.html">访谈原文</a>
            </figcaption>
          </figure>
          <p><code>figure</code> 是独立单元,<code>figcaption</code> 是它的说明。</p>
        </section>
      </main>

      <footer>
        <p>示例数据,仅用于教学。</p>
      </footer>
    </div>
  </body>
</html>