views:

850

answers:

6

Within an article-oriented page (such as a blog post), the <h1> element (level 1 heading) is commonly used to markup either:

  • the blog title (i.e. the often-large site title at the top of the page, not to the <title> element), or
  • the article title

What is the best choice and why?

To the site owner, who may want to shout out to the world the name of their site/blog, using a level 1 heading around the site title might seem to make sense.

From the perspective of what you are trying to communicate to the user, the site title is of less relevance - the article content is what you're trying to communicate and all other site content is secondary. Therefore using <h1> for the article title seems best.

I feel the <h1> element should focus on the article title, not the site title or other content. This does not appear to be a popular convention by any means.

Examples:

  • Joel Spolsky uses <h1> for the article title, and an anchor for the site title
  • Jeff Atwood uses no <h1> at all, <h2> for the article title and an anchor for the site title
  • 37 Signals' SVN uses <h1> for the site title and an anchor for the article title

That's three different approaches across three sites where you might expect a strong consideration for correct semantic markup.

I think Joel has it right with Jeff a close second. I'm quite surprised at the markup choices by the 37Signals people.

To me it seems quite a simple decision: what is of greatest relevance to the consumer of the article? The article title. Therefore wrap the article title in an <h1> element. Done.

Am I wrong? Are there further considerations I'm missing? Am I right? If so, why is the '<h1> for article title' approach not more commonly used?

Is the decision of where to use the <h1> element as invariable as I put it? Or are there some subjective considerations to be made as well?

Update: Thanks for all the answers so far. I'd really appreciate some angle on how the use of the <h1> for the article title instead of site title benefits usability and accessibility (or doesn't, as the case may or may not be). Answers based on fact instead of just personal supposition will get many bonus points!

A: 

There should only be one, and there must be one only

h1
; usually this is the page title. Then it should follow h2, h3 etc.

So your page can look like this (without all the other html tags)

h1
  h2
  h2
    h3
..etc
Dr. Hfuhruhurr
The question in this case being: Is the page title the site title or the article title?
Jon Cram
+6  A: 

On your blog's home page, I would use H1 to denote the site title and H2 for the titles of the individual blog posts that are published on the front page.

When entering a particular article, though, I would use H1 for the article title and an anchor for the site title.

This is a nice and semantic setup that will also be appreciated by Google when it crawls your site.

JacobE
+14  A: 

There is a W3C recommendation about this topic:

<h1> is the HTML element for the first-level heading of a document:

  • If the document is basically stand-alone, for example Things to See and Do in Geneva, the top-level heading is probably the same as the title.

  • If it is part of a collection, for example a section on Dogs in a collection of pages about pets, then the top level heading should assume a certain amount of context; just write <h1>Dogs</h1> while the title should work in any context: Dogs - Your Guide to Pets.

xsl
+2  A: 

On Wikipedia the h1-Tag contains the article-name and headings in the document start with h2. The name Wikipedia is part of the title-tag in the html-header. I also think that's the way to go. So for blogs I would do like Joel Spolsky in the examples you have given.

And I would always start with the highest level, so letting out h1 is in my opinion a bad option.

Mnementh
+2  A: 

The <head> part of a HTML page has an element named <title>. As the name implies, this is for the site title.

HTML is used to structure a page into a machine parse-able form, not for layouting. If it was only about layouting, you could only use <div> and <span> blocks with different classes/ids and apply CSS to them. Instead of

<h2>Sub Header</h2>

I could use

<div class="header2>Sub Header</div>

and somewhere have some CSS code that will make this <div> look like h2 (font size, bold font, etc.). The difference is that a computer can't know that my <div> is in fact a second level header in the first example (how should it know that? I might name it differently than "header2"), however in the first case, it knows that it is a second level header by the fact that it is a <h2> element and if it wants to show the user a structured list of head-lines of a page, it can do so

  • Top Level Header
    • Sub Header
      • Sub Sub Header
    • Sub Header
    • Sub Header
  • Top Level Header
    • Sub Header
      • Sub Sub Header
      • Sub Sub Header
    • Sub Header
      :

by searching for the H1/H2/H3/... elements and structuring them as above. So if a computer tries to find out the title of a page, where will it look for it? In an element named <title> or in an element named <h1>? Think about that for a moment and you have your answer.

Of course you might say "But the title is not visible on the page". Well, it is usually visible in the browser window somewhere (window title or at least tab title) - however, you may want it to be visible on the page as well - I can understand that. However, what speaks about doing that? Who says you may not repeat it? But I wonder if you should use a h1 element for that.

<html>
<head>
<title>SOME TITLE</title>
</head>
:
<body>
<div id="title">SOME TITLE</div>
:
</body>
</html>

Use CSS to style #title the way you like. Make it super big and super bold and have an eye catching color if you like, nothing speaks against it. Automatic page parsers usually ignore div and span to some degree, as it tells them nothing (these are elements used to layout the page for the reader, but they say nothing about the structure of the page. LAYOUT is not STRUCTURE, you can only apply style to certain structural elements to generate a layout, but one should not be confused with the other one). Still a computer will know what the title of the page is, it knows it thanks to the title element.

Mecki
Thanks for the comprehensive answer. I was, however, not looking for an explanation of how one applies structure vs style and other such matters. I'm more interested in the semantic difference between using an `<h1>` around a site title instead of an article title (or the other way round).
Jon Cram
Jon, i think Mecki did answer that question too. The 'correct', but less used, convention would be to not to use H1 around the site title.
Karan
+5  A: 

As a screen reader user the heading level doesn't matter as long as it's consistent. Different blogs use different conventions, so there is no standard way to make it more accessible. Making sure the headings match to the content level is more important then what level of heading is used. For example if displaying a series of blog posts with comments all the blog posts could have heading level 2 and at the start of the comments you could have heading level 3. For an example of easy to navigate headings find any Wikipedia article with multiple sections and subsections. I can easily skip around main sections by using my screen readers navigate by heading feature to jump to any level 2 heading, and if I want to move to subsections of a given sections I will navigate to the next heading.

Jared