<hgroup>:標題群組元素
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
嘗試一下
<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>
元素允許將標題與任何次要內容(例如副標題、替代標題或標語)分組在一起。每種類型的內容都以 <p>
元素表示在 <hgroup>
內。
<hgroup>
本身對於網頁的文件大綱沒有影響。相反,<hgroup>
內部允許的單一標題對文件大綱有貢獻。
範例
html
<!doctype html>
<title>HTML Standard</title>
<body>
<hgroup id="document-title">
<h1>HTML: Living Standard</h1>
<p>Last Updated 12 July 2022</p>
</hgroup>
<p>Some intro to the document.</p>
<h2>Table of contents</h2>
<ol id="toc">
…
</ol>
<h2>First section</h2>
<p>Some intro to the first section.</p>
</body>
結果
無障礙議題
目前 <hgroup>
元素沒有強烈的無障礙語義。該元素的內容(標題和可選段落)是由瀏覽器無障礙 API 公開的。
技術摘要
規範
Specification |
---|
HTML # the-hgroup-element |