What´s the difference between h1 and the title?
The HTML5 (CR) spec contains the difference between title
and h1
(containing the site title):
Authors should use titles that identify their documents even when they are used out of context, for example in a user's history or bookmarks, or in search results. The document's title is often different from its first heading, since the first heading does not have to stand alone when taken out of context.
I also read that in HTML 5 the h1 tag can be used more than once on a page, and is used for headers in section […]
Yes, in HTML5, you could use h1
everywhere, and you would never need to use h2
-h6
, if (and only if!) you use sectioning content elements correctly, which are: section
, article
, aside
and nav
. Why? Because:
The first element of heading content in an element of sectioning content represents the heading for that section.
So it’s the first heading, no matter which level it has.
[…] (isn´t that the header tag´s work?)
No, the header
element is for "introductory content" of a section, which may (not must) include the section’s heading, but it may contain more than that.
If I have a logo on my page that is a picture with the name of my site, what tag should I use? I allways though h1 was for that.
Yes, it should be a h1
that is a child of body
and of no other sectioning content element. This represents the site heading. Everyting else on this page (the navigation, the main content, etc.) is in the scope of this site heading.
Example:
<body>
<h1><img src="…" alt="ACME Inc." /></h1> <!-- ← the site heading -->
<nav></nav> <!-- the site’s navigation -->
<article> <!-- the main content of this page -->
<h1>My favorite book</h1>
</article>
</body>
This document would create the following outline:
1. ACME Inc.
1.1 (implicit; navigation)
1.2 My favorite book