<hgroup>
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月.
<hgroup> HTML 元素代表文档标题和与标题相关联的内容,它将一个 <h1>–<h6> 元素与一个或多个 <p> 元素组合在一起。
尝试一下
<hgroup> <h1>Frankenstein</h1> <p>Or: The Modern Prometheus</p> </hgroup> <p> Victor Frankenstein, a Swiss scientist, has a great ambition: to create intelligent life. But when his creature first stirs, he realizes he has made a monster. A monster which, abandoned by his master and shunned by everyone who sees it, follows Dr Frankenstein to the very ends of the earth. </p> hgroup { text-align: right; padding-right: 16px; border-right: 10px solid #00c8d7; } hgroup h1 { margin-bottom: 0; } hgroup p { margin: 0; font-weight: bold; } 属性
这个元素仅包含全局属性。
使用说明
<hgroup> 元素允许将一个标题与任意次要内容(例如子标题、副标题或口号)组合在一起。在 <hgroup> 中,这些类型的内容也表示为 <p> 元素。
<hgroup> 本身对网页的文档大纲没有任何影响。而 <hgroup> 中所允许的单个标题则会被用于文档大纲。
示例
html
<!doctype html> <title>HTML 标准</title> <body> <hgroup id="document-title"> <h1>HTML:现行标准</h1> <p>更新于 2022 年 7 月 12 日</p> </hgroup> <p>文档的介绍。</p> <h2>目录</h2> <ol id="toc"> … </ol> <h2>第一节</h2> <p>第一节的介绍。</p> </body> 无障碍考虑
目前,<hgroup> 没有无障碍的语义。只有其中的元素(标题和可选的段落)会被暴露给浏览器的无障碍 API。
技术概要
规范
| Specification |
|---|
| HTML> # the-hgroup-element> |