Semantic uses of <h1>, <h2> ... <h6> HTML tags

What is it for?

<h1><h6> tags are intended to mark up various levels of headings and subheadings.

<h1> carries the biggest importance, with each heading below carrying lesser importance.

Appropriate uses

Use only one <h1> per page

<h1> tag is intended to denote the highest level heading on a given web page.

It explains what the web page is about, and since a good web page ought to have one purpose, <h1> tag should therefore be used only once on each web page to avoid confusion.

This guideline is not in the HTML specification, but has been adopted by all good web developers I have met and worked with so far.

It is also a guideline accepted by SEO experts since Google and other search engines treat the <h1> tag with high level of importance.

Use <h1> tag on any given page only once and make sure it uniquely entitles what the page is about.

Use <h2> as component level headings

Take a look at an example of how to use <h2> tags as component level headings.

<div id="news">
   <h2>Latest News</h2>
   <ul>
      <li><a href="www.example.com">News item 1</a></li>
      <li><a href="www.example.com">News item 2</a></li>
   </ul>
</div>

If you needed subheadings within the scope of this component you would follow up with <h3> subheadings. For example:

<div id="news">
   <h2>Latest News</h2>
   <h3>Business</h3>
   <ul>
      <li><a href="www.example.com">News item 1</a></li>
      <li><a href="www.example.com">News item 2</a></li>
   </ul>
   <h3>Science</h3>
   <ul>
      <li><a href="www.example.com">News item 1</a></li>
      <li><a href="www.example.com">News item 2</a></li>
   </ul>
   <h3>Education</h3>
   <ul>
      <li><a href="www.example.com">News item 1</a></li>
      <li><a href="www.example.com">News item 2</a></li>
   </ul>
</div>

Inappropriate uses

Heading levels are seemingly simple tags to utilise within web pages, but even they have been somewhat abused by developers and tools which generate them.

Thinking about them in context of many different systems also makes the issue somewhat more complex and some lateral thinking is required to code them up most appropriately.

<h1> around the logo or company name

<h1> should not be used around the logo or the company name.

The simplest way to explain the reasons behind this is to take an example of BBC web site, which, if it had <h1> wrapped around it’s logo would have couple of million pages with ‘BBC’ as the main title on each page.

It is obvious from this example that it is not semantic to wrap an <h1> around the logo or company name on any web site, small or big.

Doing so decreases semantics of such web pages and is therefore bad practice.

It is also arguable that if there is no ‘cadidate content’ for an <h1> on a given page, then the Information Architecture of the given page is wrong and needs to be re-thought.

Essentially, good design should include a clean title and purpose for existence of each page and a developer should wrap that main title into <h1> level heading.

The only place where <h1> makes sense to be used around a logo is on the very homepage, just like it is the case with BBC web site.

The homepage represents an overview of what the organisation offers, hence on the homepage the main of ‘British Broadcasting Corporation’ makes sense for the BBC web site.

<h1> as heading for components

Once again, there should be only one <h1> heading on each web page.

Some developers (usually the ones from design backgrounds) have misinterpreted the purpose of <h1> and have decided to go along with the development practice of using an <h1> heading within each component.

This usually results in several <h1> tags being used across any given page, with <h2> tags and lower level tags getting either very little or no prominence.

<h2> tags are much more appropriate for component level headings and should be used for that purpose.

If a component is taken out of context from one page and placed into another page, the <h2> heading of that component will not confuse with the semantics of <h1> tag on the new page.

Repeating <h1> many times on one page

This should never be used as it dilutes the overall meaning (semantics) of the page and confuses screen reader users.

Misusing headings for visual display purposes

This misuse of heading tags is usually observed with amateur developers who do not understand semantics.

Under no circumstances should you use a given HTML tag just because it renders in a certain way in the browser.

You should always use CSS for look and feel and disregard the default rendering within the browser to achieve desired design effects.

Only pay attention to what the meaning (i.e. semantics) of the tags actually are.

Muddy areas

Should <h1> contain the same content as <title> tag?

Most SEO experts think so and it seems to make sense, but also throws up a question about purpose of having both <title> and <h1> tags if they are going to contain exactly the same content?

This is the reason why proposed <h> tag in XHTML2.0 makes much sense, as it makes the ‘level’ of a given heading less contextually sensitive.

It also allows page level as well as component level headings to be more ubiquitous and reusable from system to system, without developers having to change the code around to make every interface as semantic as possible when reusing the code.

What’s the purpose of low level headings?

It is also the case that tags <h4>, <h5> and <h6> are an overkill for most every day web sites, but can be too limiting for chunky, long, detailed PhD type dissertations which may require many more heading levels.

This is where it could be argued that HTML specification falls short, making the XHTML2.0 <h> proposal very viable in this respect.

Once again, using <h> would solve this problem enabling any number of nested headings, but I wonder how we would be able to style these in a meaningful manner using current CSS implementation and specification.

Written by Jason Grant, BSc, MSc on 24th April 2009

17 Responses - Join the conversation

  1. I knew some websites which have more than one h1 and even without h1, still ranks high on SERPs (see my post).

    Jason, your label tag is below the input box. Was that really great option?

    dani on 1st May
  2. Jason, thanks for this informative piece!

    As someone who learnt (and is still learning) HTML on the run, I appreciate your insights.

    What do you think of tools such as MS Expression, MS Visual Studio or Adobe Dreamweaver in this respect? When used by amateur developers, who rarely look at the code because they are only concerned with the visual layout, do these sort of programs misuse heading tags?

    David B. on 19th July
  3. Thanks for the comment and question David B. Programs you mentioned tend to misuse HTML, full stop. This is the reason why top professional HTML developers in the world do not use Dreamweaver and so on. Dreamwaver is also a relatively heavy tool considering it’s only essentially a code editor, so it wastes precious computer memory too, which can be an issue when you are working with several tools open in parallel (Photoshop, VMWare, a code editor, 25 browser tabs, etc.). If you want to know what code editor you could use as an alternative, take a look at my overview of code editors. Cheers.

    Jason Grant on 19th July
  4. I don’t think there will ever be a definitive answer, and I agree with the comments that sites should be judged on a case-by-case basis.

    What the ‘most important heading’ is depends entirely on the website.

    Shally on 27th July
  5. Thanks for the comments. The H1 and H2 (Header Texts) are highly important – search engine crawl the web page and see title, description, header tag to know what page is about?
    I must say, so many people don’t know how to use tag, tag and so on.
    for more clarification see this link http://www.w3.org/QA/Tips/Use_h1_for_Title

    Vipul Sharma on 26th August
  6. Great post. I agree with that you say. I always make sure that the h1 tag :
    • Is used only once in each page[1]
    • Contains target keywords
    • Is descriptive and unique
    • Is placed at the top of each page
    • Is placed under the breadcrumb trail.
    • Is styled using an external CSS rule

    Stefanos on 24th November
  7. The guidelines are convincing. Do the H2 tag keyword is the next best variation of the H1 tag keyword?

    I am strugling with the content of my site to structure it accordingly both for the SEs and Visitors. You suggestions would be a great mind opener.

    Thanks.

    How to Sell A House on 25th November
  8. Your statement is logical and convincing, but not accurate. H1 tags were created to control the size of your heading, not to denote the “highest level heading.”

    There are times when it is logical to have more than one section and in such a case, it is logical and correct to have more than one h1 tag.

    Not convinced? I used to think the ethical, spam free rule was only one per page, but then I listened to a video of Matt Cutts, who heads up Google’s spam team, in which he said otherwise. The one-minute vid is here: http://www.youtube.com/watch?v=GIn5qJKU8VM.

    M.-J. Taylor on 9th January
  9. @M. J. Taylor – Thanks for the link to the Google video with Matt Cutts. This YouTube channel is quite interesting and I have now subscribed.

    @Jason – Thanks again for the thought provoking post. It is still generating interesting feedback.

    David B. on 22nd January
  10. This is dead helpful. First article I’ve come across that has explained it so clearly. Using the example of BBC helps too. Thanks.

    Bim on 25th February
  11. I only use the h1 tag once per page. Then I use the h2, h3, h4, h5, h6 successively down the page. That seems to be the intention of their design, but on occasion I am tempted to use an h2 two or more times on a page. Does anyone know if it is wrong to use multiple h2 or h3 tags.?

    Kern on 3rd March
  12. Woops! – I have spent the last couple of months building and promoting my Dog Walking site.
    All was going well untill I did used an HTML Meta Analyzer. No H1 or H2 tags found.
    I will now add both heading Tags to all my pages using an external css to maintain the design integrity.

    Without resources like this page web developement and basic SEO would be very difficult for people like myself, thanks so much.

    Joe Dyer on 11th April
  13. Thanks for your kind words Joe.

    Jason Grant, BSc, MSc on 12th April
  14. @Kern
    The h2, h3, etc. tags are intended for nesting of headings — i.e. sub-headings and sub-sub-headings, much like in a technical paper. Hence, multiple h2 (etc) tags are ok. This h1 tag is special in this respect. It can be thought of as the ‘top-level’ heading for that page.

    pog on 16th April

Contribute your expertise