Re: should HTML have a <heading> element?

Tim makes some good points, we will still need headings with levels if no
sections are used.

<heading>foo</heading>
<heading>bar</heading>
<heading>baz</heading>

Will result in:
1. foo
2. bar
3. baz

Whereas:

<heading>foo</heading>
<section>
  <heading>bar</heading>
</section>
<heading>baz</heading>

Will result in:
1. foo
  1. bar
2. baz

I'm just not fan of having explicit "levels" in tags (headings really are
the exception anyway), it's also extremely error-prone as missing headings
will have to be "corrected" by the browser.

Fun fact, these mark-ups produce the exact same outline:

<h1>foo</h1>
<h2>bar</h2>
<h1>baz</h1>

<h1>foo</h1>
<article>
  <h1>bar</h1>
</article>
<h1>baz</h1>

<h1>foo</h1>
<article>
  <h6>bar</h6>
</article>
<h1>baz</h1>

So we don't need a level on the first heading in an implied section anyway.
I'm just not sure if there really is an elegant solution to this problem.


On 9 May 2014 10:34, <intelligentdesigner@timgallantcreative.com> wrote:

> | And use both versions <h1>, <h2> and <heading> in the same HTML file is
> more complicated to understand.
> | The attribute will permite define the level of heading without use a
> <section> element.
>
> To be clear, that has *always* been the case. Level of heading has never
> needed a <section> element (which was just introduced in HTML5) to be
> defined. Headings have always clearly implied the semantic structure. The
> difficulty was not lack of hierarchical definition, but how to integrate
> two or more very different kinds of thing in a document. This is why we
> ended up with explicit tags for <header>, <section>, and <aside>.
>
> But so far as hierarchy within one kind of content on a page goes,
> headings have never been problematic. A new heading always implies a new
> section or subsection, and one level higher numerically is always nested
> within the level one level lower. I.e. an h4 is always within the section
> created by the preceding h3, that h3 is always within the section created
> by the preceding h2, and so on. This structure in itself has never needed a
> <section> element. The questions have arisen more with how to be semantic
> with things that do not belong to the main content, but still require
> hierarchy.
>
> Tim Gallant
> http://timgallantcreative.com
>
>

Received on Friday, 9 May 2014 15:01:42 UTC