Main Menu

Introducing <subhead>

Dear W3C

You’ve been seeing <main> for a while now, and I’m happy for you. <main> will help screen readers and other assistive technologies understand where the main content begins. I figure that since you had already distinguished asides and sections, maybe you thought, “why not clarify the remainder?” Of course, I’m not sure where this leaves content that isn’t explicitly in <main>, <article>, <section>, or <aside> now.

<main>I found my special purpose!</main>
<p>Where did I come from and why am I here?</p>

Nevertheless, I can understand the desire for such a definite element.

So, about headings

Listen, it’s been a while now, and you’ve still not added an element to mark up subheadings, subtitles, alternative titles or taglines, and it’s time we talked about it. This is a sore subject, and I can understand why. Things with <hgroup> didn’t work out too well. Let’s relive history for a moment. It’s important to remember where we come from, because it helps us move forward.

At first, <hgroup> wasn’t so bad. You figured if people were already marking up subtitles as headings, <hgroup> paved the cowpath. Then you started noticing how easy it was to goof up the strict semantics, and how often it required a detailed knowledge of the markup structure. Then you started questioning whether you had added it “simply to support the newly created outline algorithm”. And let’s be honest, you started doubting the new outline algorithm altogether, because you certainly weren’t a fan of sectioning elements reseting <h1-6>. It wasn’t long after when you broke it off.

But the WHATWG did not drop <hgroup>, so developers are caught in a rift. It’s hard to implement a standard in an area where two major standards bodies have irreconcilable differences. And let’s be frank, the WHATWG’s real world examples accurately reflect the usefulness for an element to signify a subheading, subtitle, tagline or byline. After all, that’s why they have not dropped <hgroup>.

There is another

So, if you’re still a fan of clarifying elements like <main>, then I would like to introduce <subhead>, the element you’ve been looking for. You can read the proposal, or review the spec.

Remember those real world examples? <subhead> covers these and more (bylines, taglines, etc.), and its semantically less confusing. Unlike <hgroup>, <subhead> is more backward compatible because it does not force a new <h1-6> grouping pattern upon the markup where none previously existed. <subhead> also addresses scenarios where the subheading does not immediately follow the heading element.

<subhead> is cleaner than some of the hackier alternatives. Unlike <small>, it’s neither an inline or sectioning aside, and it doesn’t represent a side-comment or “small print”. And unlike <aside>, it doesn’t represent a section of tangentially related content. I know you never recommended these methods in your suggested alternatives, but these are just ways clever developers have tried to fill the hole.

So, yea

<subhead> gives authors a clear and flexible element to mark up existing and future content structures. <subhead> does not require taglines, bylines, subtitles etc. to be marked up as <hx> headings, and <subhead> can be a child of a heading or a sibling of a heading.

<h1>Dr. Strangelove <subhead>or: How I Learned to Stop Worrying and Love the Bomb</subhead></h1>

<h1>brucelawson.co.uk</h1>
<subhead>Gorgeousness in a gimp mask</subhead>

How would subhead cope when you need more than one subheading (e.g., a sub-subheading)? I can’t help but think that using something like ‘for’, as in form labels, might help link headings and subheadings more usefully and could be used with a variety of tags depending on the appropriateness of the context.

En_joy

I think an element like this should always be the child of an hX, and allow multiple per heading.

This satisfies every use-case in the W3C “Real World Examples” for hgroup.

Also: “subhead” should be “subheading”, as the former implies a relationship with the head element.

Amelia Bellamy-Royds

I really don’t see how this is an improvement on “. It is essentially just a semantic name for a stylistic span within a heading. And while that is better than using a non-semantic “ for the same purpose, it doesn’t cover all the potential variations of headline structures and styles.

How would you neatly and clearly mark that up with nested elements while still maintaining the hierarchical structure? With an hgroup you can clearly define the importance level of each component element within the heading.