From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/zh-cn/web/html/element/hgroup/index.html | 171 +++++++++++++++++++++++++ 1 file changed, 171 insertions(+) create mode 100644 files/zh-cn/web/html/element/hgroup/index.html (limited to 'files/zh-cn/web/html/element/hgroup/index.html') diff --git a/files/zh-cn/web/html/element/hgroup/index.html b/files/zh-cn/web/html/element/hgroup/index.html new file mode 100644 index 0000000000..99a782ad8c --- /dev/null +++ b/files/zh-cn/web/html/element/hgroup/index.html @@ -0,0 +1,171 @@ +--- +title:
+slug: Web/HTML/Element/hgroup +tags: + - Element + - Experimental + - HTML + - HTML sections + - HTML5 + - Web + - 实验性 +translation_of: Web/HTML/Element/hgroup +--- +
{{HTMLRef}}
+ +
+ +
HTML <hgroup> element代表文档章节所属的多级别的目录,它将多个<h1>至<h6>的子元素组装到一起。
+ +
+ +
{{EmbedInteractiveExample("pages/tabbed/hgroup.html", "tabbed-standard")}}
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Content categoriesFlow content, heading content, palpable content.
Permitted contentOne or more {{HTMLElement("h1")}}, {{HTMLElement("h2")}}, {{HTMLElement("h3")}}, {{HTMLElement("h4")}}, {{HTMLElement("h5")}}, and/or {{HTMLElement("h6")}}.
Tag omission{{no_tag_omission}}
Permitted parent elementsAny element that accepts flow content.
Permitted ARIA roles{{ARIARole("tab")}}, {{ARIARole("presentation")}}
DOM interface{{domxref("HTMLElement")}}
+ +

属性

+ +

这个元素仅包含全局属性。

+ +

使用笔记

+ +
+

注意: 本元素已经从HTML5(W3C)规范中删除,但是它仍旧在 WHATWG 的 HTML 版本里。大多数浏览器都部分地实现,所以它不太可能消失。 
+ 然而,考虑到<hgroup>元素的一个关键存在目标是明确HTML规范中如何显示标题的轮廓算法,但因为其轮廓算法(outline algorithm)未在任何浏览器中实现,因此 <hgroup> 语义仍旧是理论上的建议。
+ HTML5 (W3C) 规范提供了如何标记副标题,小标题,可选标题和标语(Subheadings, subtitles, alternative titles and taglines)的建议。

+
+ +

The <hgroup> element allows the primary heading for a document section to be grouped with any secondary headings—such as subheadings or alternative titles—to form a multi-level heading.

+ +

In other words, the <hgroup> element prevents any of its secondary <h1>–<h6> children from creating separate sections of their own in the outline—as those <h1>–<h6> elements otherwise normally would if they were not children of any <hgroup>.

+ +

So in the abstract outline produced by the HTML outline algorithm defined in the HTML specification, the <hgroup> as a whole forms a single logical heading, with the entire set of <h1>–<h6> children of the <hgroup> going into the outline as one multi-level unit, to comprise that single logical heading in the abstract outline.

+ +

To produce any (non-abstract) rendered view of such an outline, some choice must be made in the design of the rendering tool about how to render <hgroup> headings in such a way as to convey their multi-level nature. There are a variety of ways an <hgroup> might be shown in a rendered outline; for example:

+ + + +

Consider the following HTML document:

+ +
<!DOCTYPE html>
+<title>HTML Standard</title>
+<body>
+  <hgroup id="document-title">
+    <h1>HTML</h1>
+    <h2>Living Standard — Last Updated 12 August 2016</h2>
+  </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>
+ +

A rendered outline for that document might look like the following:

+ +

+ +

That is, the rendered outline might show the primary title, HTML, followed by a colon and space, followed by the secondary title, Living Standard — Last Updated 12 August 2016.

+ +

Or, the rendered outline for that document might instead look like the following:

+ +

Rendered outline that includes an <hgroup> element, with parens around the secondary heading

+ +

That is, the rendered outline might show the primary title, HTML, followed by the secondary title shown in parentheses: (Living Standard — Last Updated 12 August 2016).

+ +

示例

+ +
<hgroup>
+  <h1>Main title</h1>
+  <h2>Secondary title</h2>
+</hgroup>
+
+ +

浏览器兼容性

+ +

{{CompatibilityTable}}

+ +
+ + + + + + + + + + + + + + + + + + + +
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support5{{CompatGeckoDesktop("2.0")}}9.011.104.1
+
+ +
+ + + + + + + + + + + + + + + + + + + +
FeatureAndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support2.2{{CompatGeckoMobile("2.0")}}9.011.05.0
+
+ +

参阅

+ + -- cgit v1.2.3-54-g00ecf