1. 面向开发者的 Web 技术
  2. HTML(超文本标记语言)
  3. HTML 参考
  4. HTML 元素参考
  5. <figcaption>

此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。

View in English Always switch to English

<figcaption>:图像标题元素

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨2015年7月⁩.

<figcaption> HTML 元素是用来描述其父节点 <figure> 元素里的其余内容的标题或说明。为 <figure> 提供一个无障碍描述

尝试一下

<figure>
 <img
 src="/shared-assets/images/examples/elephant.jpg"
 alt="Elephant at sunset" />
 <figcaption>An elephant at sunset</figcaption>
</figure>
figure {
 border: thin #c0c0c0 solid;
 display: flex;
 flex-flow: column;
 padding: 5px;
 max-width: 220px;
 margin: auto;
}
img {
 max-width: 220px;
 max-height: 150px;
}
figcaption {
 background-color: #222;
 color: #fff;
 font: italic smaller sans-serif;
 padding: 3px;
 text-align: center;
}

属性

该元素仅包含全局属性

示例

有关 <figcaption> 的示例,请参见 <figure> 页面。

技术概要

内容分类 无。
允许的内容 流式内容
标签省略 不允许,开始标签和结束标签都不能省略。
允许的父元素 <figure> 元素;<figcaption> 元素必须是它的第一个或者最后一个子节点。
隐式 ARIA 角色 没有对应的角色
允许的 ARIA 角色 groupnonepresentation
DOM 接口 HTMLElement

规范

Specification
HTML
# the-figcaption-element

浏览器兼容性

参见

Help improve MDN

Learn how to contribute

This page was last modified on by MDN contributors.

AltStyle によって変換されたページ (->オリジナル) /