Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS Sass Basics (retired) Getting Started with Sass Advanced Nesting

<H1> tags

In this example, there are two <h1> tags on the same page...is this not bad practice? (I know it is just an example, but is this ever a legitimate practice?)

4 Answers

It all depends if you are using HTML5 or not. If you are using the HTML5 section element, then each section can have its own h1. You can also have multiple header and footer elements on the page.

Take a look at the article on the w3c website - http://www.w3.org/html/wg/drafts/html/master/sections.html#outlines

Also there is an article on developer.mozilla.org that shows the difference between the structure of a HTML 4 document and how the HTML5 Outline Algorithm works.

Derek Etnyre
Derek Etnyre
20,822 Points

You are correct - having a single <H1> tag on a form is good form. It helps search engines know what the main topic of a web page is. This is an interesting article on the subject: http://webdesign.tutsplus.com/articles/the-truth-about-multiple-h1-tags-in-the-html5-era--webdesign-16824

James Barnett
James Barnett
39,199 Points

Derek Etnyre - The article you reference doesn't agree that "having a single tag on a form is good form".

Bad practice according to what standards? I recommend the following:

1) Validate your HTML according to http://validator.w3.org

2) In terms of SEO (Search Engine Optimization) just don't try to be a smartass. If you think your code makes sense to a normal human user just do it. If you are trying to deceive Search Engines such as Google you will get in trouble very soon.

In my opinion you should try to use tags for what they stand for.

So <h1> would be recommended for titles, or for example, if you have an article with several main topics and subtopics I think it would also be acceptable to use <h1> with some <h2> or <h3>. If you use a headline tag to your content it would be wrong for example.

Derek - the article you reference is really helpful...thanks