[html5] <header>, <hgroup> and subheadings

Micky Hulse mickyhulse.lists at gmail.com
Wed May 1 17:38:44 PDT 2013


Hmm, just read that the <hgroup> has been removed from the spec:

http://html5doctor.com/the-hgroup-element/

"Update 16th April, 2013. hgroup has now been removed from the HTML5
specification. We are working on an article to help guide authors on
which markup patterns they should use instead."

Interesting.

I guess I'll start the process of removing <hgroup> from my code.

Actually, I just tested this code (not using <hgroup>):

<doctype html>
<title>Hello, world!</title>
<h1>This is a section</h1>
<article>
    <heading>
        <h1>Primary heading</h1>
        <h2>Secondary heading</h2>
        <h3>Tertiary heading</h3>
    </heading>
</article>

... which produces this outline:

1. This is a section
    1. Primary heading
        1. Secondary heading
            1. Tertiary heading

That's not bad! For some reason, I was getting different results
earlier when outlining a bigger site.

Ah, maybe I was getting odd results because I had a structure like this:

<doctype html>
<title>Hello, world!</title>
<h1>This is a section</h1>
<article>
    <heading>
        <h3>Tertiary heading</h3>
        <h1>Primary heading</h1>
        <h2>Secondary heading</h2>
    </heading>
</article>

... which gives me this outline:

1. This is a section
    1. Tertiary heading
    2. Primary heading
        1. Secondary heading

I never realized that the order mattered. Good to know!

So, how does one handle a subheading that is supposed to appear above
a main heading? I don't always want my <h1> to be the first in the
flow due to importance of the heading, right?

<h3>Least important heading</h3>
<h1>Most important heading</h1>
<h2>Second most important heading</h2>

Using the above, without an <hgroup> throws off the outliner.

Strange.


On Wed, May 1, 2013 at 4:56 PM, Micky Hulse <mickyhulse.lists at gmail.com> wrote:
> Hello,
>
> Using the outliner (ya'll probably know this link by heart):
>
> <http://gsnedders.html5.org/outliner/>
>
> Example #1:
>
> <doctype html>
> <title>Hello, world!</title>
> <h1>This is a section</h1>
> <article>
>     <heading>
>         <hgroup>
>             <h1>Primary heading</h1>
>             <h2>Secondary heading</h2>
>             <h3>Tertiary heading</h3>
>         </hgroup>
>     </heading>
> </article>
>
> ... creates this outline:
>
> 1. This is a section
>     1. Primary heading
>
> Example #2:
>
> <doctype html>
> <title>Hello, world!</title>
> <h1>This is a section</h1>
> <article>
>     <heading>
>         <hgroup>
>             <h1>Primary heading</h1>
>             <h2>Secondary heading</h2>
>         </hgroup>
>         <h3>Tertiary heading</h3>
>     </heading>
> </article>
>
> ... creates this outline:
>
> 1. This is a section
>     1. Primary heading
>         1. Tertiary heading
>
> Question:
>
> Which is better in terms of showing a subheading?
>
> I like how the outliner, in Example #2, insets the "Tertiary heading"
> on a new level. To me, that's how I would expect an outline to show a
> subheading of an article.
>
> On the other hand, everything I've read says to group headings
> together using <hgroup>.
>
> I know things are open to interpretation, but in your opinions, would
> it be wrong for me to leave the <h3> outside of the <hgroup>?
>
> In the real world, I'm using the <h3> for optional subheadlines to my articles.
>
> Thanks!
> Micky



-- 
http://hulse.me



More information about the Help mailing list