Re: Why hgroup?

On Thu, 06 Jan 2011 17:55:32 -0000, Anne van Kesteren <annevk@opera.com>  
wrote:

>> What advantages does <hgroup> offer over a <subtitle> or <subheading>  
>> or <whatever> element?
>>
>> <h1>heading</h1>
>> <whatever>subtitle</whatever>
>
> It's much more clear which two elements are tied and you can more easily  
> treat them as a single unit from a CSS/JavaScript perspective.

Although <hgroup> offers easy grouping, it also makes styling more  
difficult by forbidding all other elements inside the group. And grouping  
can be easily replaced with <div class=hgroup>.

 From DOM processing perspective it also complicates things, because hx is  
no longer a heading — it's either a heading or a subtitle, and processing  
tools have to check parent element and compare all its children to figure  
that out.


I wish <hgroup> was dropped.

It's confusingly similar to <header>. I think that an average author  
learning from pages' source is not going to figure out the distinction.

Its advantage is only significant when complex titles are marked up (e.g.  
with subtitle preceding main title), but I'm not convinced that is an  
important and popular use case.


I'd prefer:

<h1>heading</h1><subtitle>subtitle</subtitle>

or

<h1>subtitle <main-part-of-the-title>heading</main-part-of-the-title>  
subtitle</h1>

or

<h1 abbr="heading">subtitle: heading — subtitle or whatever</h1>

or nothing.

<h1>heading</h1><p class=subtitle>subtitle</p>

is not that bad, and still better than having two header-releated grouping  
elements in HTML.

-- 
regards, Kornel Lesiński

Received on Thursday, 6 January 2011 19:45:11 UTC