W3C home > Mailing lists > Public > public-html@w3.org > January 2011

Re: hgroup: a possible alternative

From: James Graham <jgraham@opera.com>
Date: Mon, 10 Jan 2011 23:46:52 +0100 (CET)
To: Toby Inkster <tai@g5n.co.uk>
cc: HTML WG LIST <public-html@w3.org>
Message-ID: <alpine.DEB.2.00.1101102333130.6155@sirius>

On Mon, 10 Jan 2011, Toby Inkster wrote:

> Not sure if there's an open issue on hgroup that's accepting change
> proposals, but here's the stub of an alternative idea for discussion
> anyway.
> It seems to me that much of the dislike of <hgroup> can be solved by
> turning it inside out. Instead of:
> 	<hgroup>
> 		<h1>Medieval Beekeeping</h1>
> 		<h2>The evolution of an artform</h2>
> 	</hgroup>
> You could have:
> 	<h1>
> 		<hline>Medieval Beekeeping</hline>
> 		<hline small>The evolution of an artform</hline>
> 	</h1>

Why not <h1>Main Heading <subhead>Subheading</subhead></h1>, where a 
heading element can have 0 or more <subhead> children that represent 
subheadings (we can bikeshed over the name of course). This requires less 
markup than <hgroup> or this <hline> proposal. I also think it works 
marginally better for CSS since the selectors for each part are simpler 
(assuming we get :heading(n) to select n-th level headings):

:heading(n) {/*rules for the heading*/}
:heading(n) > subhead {/*special rules for the subheading*/}

Compared to <hgroup> it is more obvious what :heading would select (there 
is no <hgroup> vs child-that-represents-the-heading confusion) and it is 
easier to select the subheading(s) since they always have the same element 
name. Compared to <hline>+<hline small> it removes the need for an 
attribute selector.

Semantically, it is arguably less flexible than <hgroup> since one cannot 
have different subheadings of different rank, but that seems like a minor 
use-case. It has slightly different fallback behaviour since legacy UAs 
will presumably consider the whole element a single heading rather than 
multiple headings. This seems theoretically cleaner, although I don't know 
how much difference it makes in actual UAs. <subhead> also has the benefit 
of simplifying the outline algorithm somewhat compared to <hgroup>.
Received on Monday, 10 January 2011 22:50:30 UTC

This archive was generated by hypermail 2.4.0 : Saturday, 9 October 2021 18:45:29 UTC