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

hgroup: a possible alternative

From: Toby Inkster <tai@g5n.co.uk>
Date: Mon, 10 Jan 2011 10:44:13 +0000
To: HTML WG LIST <public-html@w3.org>
Message-ID: <1294656253.31359.31.camel@ophelia2.g5n.co.uk>
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

It seems to me that much of the dislike of <hgroup> can be solved by
turning it inside out. Instead of:

		<h1>Medieval Beekeeping</h1>
		<h2>The evolution of an artform</h2>

You could have:

		<hline>Medieval Beekeeping</hline>
		<hline small>The evolution of an artform</hline>

<hline> would be a brand new element with an optional boolean attribute
"small". You'd normally style it something like this:

	hline { display:block; }
	hline[small] { font-size: smaller; }

The "small" attribute it not really presentational - it indicates a line
within the heading of lesser significance. If someone can think of a
better name for it, please do so.

Why <hline> and not <div> or <p>? Because allowing block elements within
a heading breaks the content model of headings going back pre-HTML-2.0
and would require incompatible changes to parsers.

Stephen Stewart recently posted a link to http://goo.gl/5wCVt - a very
interesting book chapter that deals with headlines from a newspaper
editors' perspective and contains several good examples of multi-part
headers, some of which seem like they could be better represented via
the <hline> construct (often by adding class attributes to hlines)
rather than <hgroup>. Here are some of the examples from that article
marked up using <hline>:

	  <hline small class="kicker">Weird science</hline>
	  <hline>High school inventions lean toward the wacky</hline>

	  <hline class="hammer">Clinton <strong>Acquitted</strong></hline>
	  <hline small>Perjury, obstruction charges defeated</hline>

	  <hline>Olympic bid may be probed</hline>
	  <hline small class="underline">Gift violation may reopen Atlanta case</hline>

	  <hline small class="summary">Gov. Jesse Ventura blended
	    his new job with an old one, filling in for a day as a
	    talk-show host on KSTP Radio</hline>
	  <hline>Broadcast muse</hline>

There is one possible problem with this approach: headings are
traditionally written without terminal punctuation unless the
punctuation is especially significant (e.g. an exclamation point or
question mark). Given that, older screen readers which would not be
aware of the semantics of <hline> could possibly run the lines of the
heading into each other as a single sentence. I'm not sure if a
display:block presentation has any effect on this. If someone could test
whether the following is run together as a single sentence in screen
readers, that might help...

	  <span style="display:block">Hello world</span>
	  <span style="display:block">Hello world</span>

Toby A Inkster
Received on Monday, 10 January 2011 10:45:03 UTC

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