hgroup ... ⁄hgroup
HTML5 hgroup element
The hgroup element allows you to group headings h1, h2, h3, h4, h5, h6, group that represents the heading of a section. »video
About hgroup
- is an optional element
- multiple hgroup elements allowed per HTML5 document
Display & support hgroup
- display in browser »details
- display type: block





Parents, children hgroup
- hgroup nested within elements »hgroup parents
- elements nested within hgroup »hgroup children
»examples
Attributes hgroup
- required: none
- optional: global attributes, event attributes
Warning
The hgroup element influence the document outline: user agents may concatenate the heading + its subheadings, the subheadings may not be displayed at all... »video
Syntax hgroup
1 | <> ... </> »video |
Attributes and Values hgroup (comma separated)
< | attribute | = | "attribute_value(s)" | > | Video | Examples |
---|---|---|---|---|---|---|
1. specific attributes | ||||||
All Specific Attributes | ||||||
2. global attributes | ||||||
1. | accesskey | = | keyboard key | »img | <accesskey="h"> ... </ > | |
2. | class | = | class name | »html »img | <class="class_name"> ... </ > | |
3. | contenteditable | = | "", , true, false | »html | <contenteditable="true"> ... </ > | |
4. | contextmenu | = | menu id value | »html | <contextmenu="menu_id_value"> ... </ > | |
5. | data-* | = | value | - | <data-http-error="404"> ... </ > | |
6. | dir | = | ltr, rtl, auto | »html | <dir="ltr"> ... </ > | |
7. | draggable | = | true, , false | »img | <draggable="false"> ... </ > | |
8. | dropzone | = | copy, move, link, string:, file: | - | <dropzone="copy"> ... </ > | |
9. | hidden | = | "", , hidden | »html »img | <hidden="hidden"> ... </ > | |
10. | id | = | id name | »html »img | <id="unique_id_name"> ... </ > | |
11. | itemid | = | URL | - | - | |
12. | itemprop | = | string | »link »a | - | |
13. | itemref | = | string | - | - | |
14. | itemscope | = | "", , itemscope | - | - | |
15. | itemtype | = | absolute URL | - | - | |
16. | lang | = | language code | »html »head»title »img | <lang="en"> ... </ > | |
17. | spellcheck | = | "", , true, false | »html | <spellcheck="true"> ... </ > | |
18. | style | = | CSS property:value | »html »img | <style="color:red"> ... </ > | |
19. | tabindex | = | integer | »img | <tabindex="3"> ... </ > | |
20. | title | = | text | »html »link»style »abbr»dfn »img »meter | <title="html page"> ... </ > | |
21. | translate | = | "", yes, no | »html »img | <translate="yes"> ... </ > | |
All Global Attributes | ||||||
3. global event attributes | ||||||
1. | onclick | = | script | » list | <element onclick="script" > ... | |
2. | ondblclick | = | script | » list | <element ondblclick="script" > ... | |
All Event Attributes |
Video demonstration hgroup element
HTML5 hgroup element: grouping headings Tutorial
min | video details |
---|---|
00:04 | video tutorial: hgroup element |
00:10 | hgroup element represents the heading of a section, allowing you to group the next headings: h1, h2, h3, h4, h5, h6 |
00:17 | Explanations: |
00:17 | <h1> Section heading<⁄h1> represents the heading of that section |
00:22 | Question: what if we have more than 1 heading (heading + subheadings) that represents the heading of that section ? |
00:43 | in order to make the 2 headings (h1, h2) to represent the heading of the section, we need to group them → thus resulting the hgroup element |
00:49 | grouping h1 and h2 headings, by nesting them inside hgroup element |
01:08 | h1 represents the heading of the first explicit section in page |
01:13 | hgroup (h1+h2) represents the heading of the second explicit section in page |
01:20 | if you have more subheadings, these can be added inside hgroup (h1+h2+..) if you whish to be part of the hgroup = the heading of the section |