← 中文资源

简体中文版本

使用语义元素构建富内容文章

用 article、header、time、figure、blockquote、aside 与 footer 组织博客文章,包含作者、时间、配图说明和标签等元数据。

阅读英文原文

功能说明

示例展示一篇结构完整的博客文章:<article> 包裹独立内容,<header> 放置标题、副标题、作者与发布时间,正文使用二级标题分节,配图由 <figure> 和 <figcaption> 说明,引用使用 <blockquote> 与 <cite>,相关阅读放入 <aside>,页脚列出标签。它适合文章页、文档页和新闻详情页的语义骨架。

关键代码

<article>
  <header>
    <h1>Understanding Modern Web Development</h1>
    <p class="meta">
      By <a href="/authors/jane" rel="author">Jane Doe</a>
      on <time datetime="2025-01-15T10:00:00-05:00">January 15, 2025</time>
    </p>
  </header>

  <figure>
    <img src="diagram.png" alt="Diagram showing semantic HTML structure" width="800" height="400">
    <figcaption>Figure 1: Semantic HTML document structure</figcaption>
  </figure>

  <blockquote cite="https://www.w3.org/TR/html52/">
    <p>HTML is the World Wide Web's core markup language.</p>
    <cite>W3C HTML 5.2 Specification</cite>
  </blockquote>
</article>

<time> 的 datetime 提供机器可读时间,页面上则显示本地化文本。<figure> 把图片与说明绑定为一个单元,<blockquote> 的 cite 属性记录来源地址,rel="author" 和 rel="tag" 描述链接关系。标题层级从 h1 到 h2、h3,形成可导航的大纲。

使用注意

blockquote 的 cite 属性不会显示在页面上,也不能替代可见的来源说明。图片必须提供有意义的 alt,并写明宽高以避免加载时布局偏移;figcaption 是补充说明,不应重复 alt。文章内只应有一个 h1,标题层级不要为了字号而跳级。aside 表示与主内容相关但可独立省略的内容,不应把正文关键信息放进去。rel 值需要与链接实际关系一致。

验证方式

用浏览器生成文档大纲,确认标题层级从 h1 连续到 h3;在辅助功能树中检查 article、figure、blockquote 的语义和图片替代文本。再关闭图片、缩窄视口,确认说明文字仍与媒体对应,并用 HTML 校验器检查 cite、datetime 和 rel 的取值。