示例工程 14-figure-picture

14-figure-picture/demo-01-figure/index.html

html · 1.9 KB

运行:figure 演示

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

<!doctype html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>figure 演示</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: 0 0 8px; font-size: 17px; }
      p { margin: 0 0 10px; color: #334155; }
      img { max-width: 100%; height: auto; border-radius: 8px; }
      figure { margin: 8px 0 0; padding: 12px; border: 1px solid #e2e8f0; border-radius: 10px; }
      figcaption { margin-top: 8px; color: #64748b; font-size: 13px; }
      blockquote { margin: 0; padding: 6px 12px; border-left: 3px solid #2563eb; color: #1e3a8a; }
      blockquote p { margin: 0; color: inherit; }
      pre { margin: 0; padding: 10px; overflow-x: auto; border-radius: 8px; background: #0f172a; color: #e2e8f0; font-size: 12px; }
    </style>
  </head>
  <body>
    <h1>figure 演示</h1>

    <div class="box">
      <h2>图片 + 图注</h2>
      <figure>
        <img src="assets/chart.svg" alt="季度访问量柱状图,逐季上升" width="640" height="360" />
        <figcaption>图 1:季度访问量。</figcaption>
      </figure>
    </div>

    <div class="box">
      <h2>引用 + 署名</h2>
      <figure>
        <blockquote>
          <p>结构正确,内容清楚,可访问,才算完成。</p>
        </blockquote>
        <figcaption>—— 林小满</figcaption>
      </figure>
    </div>

    <div class="box">
      <h2>代码 + 说明</h2>
      <figure>
        <pre><code>figure &gt; img + figcaption</code></pre>
        <figcaption>代码块也可以作为 figure 的内容。</figcaption>
      </figure>
    </div>
  </body>
</html>