Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HGROUP element removed from the HTML5 Specification. What alternative technique can be used instead?

As some of you would of heard the hgroup element is being removed from the HTML5 Specification. (For more info, see the W3C HTML Working Group's decision on request to drop hgroup from HTML5 on the W3C's Public Mailing List archives.)

Now I'm currently working on the redesign of a site using this tag that creates a way of adding a sub heading.

My current thoughts are to just add another hX tag under the main header, but I'm not sure if this would be semantic enough to do so.

 <h1>Darren Reay</h1>
 <h2>A developing web developer</h2>
 <p>Hello World</p>

Could anyone either come up with a alternative for using sub headers or at least point me in the right direction?

like image 772
Darren Reay Avatar asked Apr 04 '13 10:04

Darren Reay


3 Answers

The HTML5 spec now includes advice on how to mark up Subheadings, subtitles, alternative titles and taglines

like image 110
Steve Faulkner Avatar answered Nov 12 '22 01:11

Steve Faulkner


I would go with the alternative suggested by the W3C in the drop hgroup change proposal proposed by Lars Gunther and use header and paragraph.

Your example would look like this

<header>
    <h1>Darren Reay</h1>
    <p>A developing web developer</p>
</header>

I feel this reads correctly and semantically.

like image 32
Colin Bacon Avatar answered Nov 12 '22 02:11

Colin Bacon


A couple of points to consider:

  1. Even if the tag is removed from the HTML5 specification, it doesn't mean that it would stop working overnight. Browsers keep backwards compatibility for a long time (AFAIK most if not all browsers still render <font> correctly!)

  2. Even if the browsers would drop support overnight, they'd still render the page correctly because I don't think the hgroup tag adds any inherent styling and (modern) browsers are very lenient in allowing tags they don't recognize.

  3. I might be reading the question wrong, but between the lines it sounds like you've been misusing the hgroup tag anyway. (It's not allowed to contain anything other than header elements.)

I don't see any problem in either dropping the tags completely or replacing them with divs.

like image 23
JJJ Avatar answered Nov 12 '22 01:11

JJJ