Heading Elements

这篇翻译不完整。请帮忙从英语翻译这篇文章

标题(Heading)元素有六个不同的级别,<h1> 是最高级的,而 <h6> 则是最低的。 一个标题元素能简要描述该节的主题。标题信息可以由用户代理可以使用,例如,自动构造某个文档中的内容表(就像本文档右边浮动栏一样)。

使用要点:

  • 不要为了减小标题的字体而使用低级别的标题, 而是使用 CSS font-size 属性。
  • 避免跳过某级标题:始终要从 <h1> 开始,接下来使用 <h2> 等等。
  • 使用 <section> 元素的时候,为了方便起见你应该考虑着去避免重复在一个页面上使用 <h1>,<h1> 应该用来表示页面的标题,其他的标题当从 <h2> 开始。 使用 section 当时候,应当每个 section 都使用一个 <h2>。 详情请参考 "Defining sections" in Using HTML sections and outlines
Content categories Flow content, heading content, palpable content.
Permitted content Phrasing content.
Tag omission 不允许,开始标签和结束标签都不能省略。
Permitted parent elements Any element that accepts flow content; don't use as a child of <hgroup> element, it is now deprecated
DOM interface HTMLHeadingElement

Attributes

These elements include the global attributes.

The align attribute is obsolete; don't use it.

Examples

All headings

The following code shows all the heading levels, in use.

<h1>Heading level 1</h1>
<h2>Heading level 2</h2>
<h3>Heading level 3</h3>
<h4>Heading level 4</h4>
<h5>Heading level 5</h5>
<h6>Heading level 6</h6>

Example page

The following code shows a few headings with some content under them.

<h1>Heading elements</h1>
<h2>Summary</h2>
<p>Some text here...</p>

<h2>Examples</h2>
<h3>Example 1</h3>
<p>Some text here...</p>

<h3>Example 2</h3>
<p>Some text here...</p>

<h2>See also</h2>
<p>Some text here...</p>

Here is the result of this code:

Specifications

Specification Status Comment
WHATWG HTML Living Standard
<h1>, <h2>, <h3>, <h4>, <h5>, and <h6>
Living Standard  
HTML5
<h1>, <h2>, <h3>, <h4>, <h5>, and <h6>
Recommendation  
HTML 4.01 Specification
<h1>, <h2>, <h3>, <h4>, <h5>, and <h6>
Recommendation  


Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support (Yes) 1.0 (1.7 or earlier) (Yes) (Yes) (Yes)
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support (Yes) 1.0 (1.0) (Yes) (Yes) (Yes)

See also

文档标签和贡献者

 此页面的贡献者: Ende93, ziyunfei
 最后编辑者: Ende93,