We're looking for a user researcher to understand the needs of developers and designers. Is this you or someone you know? Check out the post: https://mzl.la/2IGzdXS

Esta tradução está incompleta. Por favor, ajude a traduzir este artigo.

This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

O elemento HTML <hgroup> destina-se a agrupar cabeçalhos de diferentes níveis para uma seção do documento. Ele agrupa (é um container para) um conjunto de elementos <h1>–<h6>.

Content categories Flow content, heading content, palpable content.
Permitted content One or more <h1>, <h2>, <h3>, <h4>, <h5>, and/or <h6>.
Tag omission None, both the starting and ending tag are mandatory.
Permitted parent elements Any element that accepts flow content.
DOM interface HTMLElement

Attributes

Esse elemento admite apenas os global attributes (atributos globais)

Notas sobre o uso

O elemento <hgroup> foi removido da especificação do W3C para a HTML5, mas ainda se encontra na especificação HTML do WHATWG. Foi parcialmente implementado na maioria dos navegadores, contudo é pouco provável que seja incluído na especificação.
Considerando que a finalidade do elemento <hgroup> é a de definir a maneira como os títulos serão mostrados pelo outline algorithm definido na especificação da HTML e considerando ainda que o outline algorithm da HTML não está implementado em nenhum navegador, conclui-se que, na prática, a semântica do elemento <hgroup> é meramente teórica.
A especificação do W3C para a HTML5 fornece algumas sugestões para a marcação de Subheadings, subtitles, alternative titles and taglines sem que se use o elemento <hgroup>.

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:

  • an <hgroup> might be shown in a rendered outline in with a colon character and space (“: ”) or other such punctuation after the primary heading and before the first secondary heading (and with the same or similar punctuation before any other secondary headings
  • an <hgroup> might be shown in a rendered outline in with the primary heading followed by parentheses around the secondary heading(s)

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).

Examples

<hgroup id="document-title">
  <h1>HTML</h1>
  <h2>Living Standard — Last Updated 12 August 2016</h2>
</hgroup>
Specification Status Comment
HTML Living Standard
The definition of '<hgroup>' in that specification.
Padrão em tempo real  

Browser compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support5 Yes4911.14.1
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support2.2 Yes Yes4114.2 Yes

See also

Etiquetas do documento e colaboradores

Colaboradores desta página: Maujor, gabrielmelo
Última atualização por: Maujor,