试一试
<figure>
<img
src="/shared-assets/images/examples/elephant.jpg"
alt="Elephant at sunset" />
<figcaption>An elephant at sunset</figcaption>
</figure>
figure {
border: thin silver solid;
display: flex;
flex-flow: column;
padding: 5px;
max-width: 220px;
margin: auto;
}
img {
max-width: 220px;
max-height: 150px;
}
figcaption {
background-color: #222222;
color: white;
font: italic smaller sans-serif;
padding: 3px;
text-align: center;
}
属性
此元素仅包含全局属性。
示例
有关 <figcaption>
的示例,请参阅 <figure>
页面。
技术摘要
内容类别 | 无。 |
---|---|
允许内容 | 流内容. |
标签省略 | 无,起始标签和结束标签都必须存在。 |
允许父级 | 一个 <figure> 元素; <figcaption> 元素必须是其第一个或最后一个子元素。 |
隐式 ARIA 角色 | 没有对应的角色 |
允许的 ARIA 角色 |
group , none , presentation |
DOM 接口 | HTMLElement |
规范
规范 |
---|
HTML # the-figcaption-element |
浏览器兼容性
加载中…
另见
<figure>
元素。