I've been wondering whats the best practice for using a heading tag arround my logo on my website, especially with HTML5 sectioning tags.
I've read on many website and forums that I should do the following, if I want to add a heading arround my logo:
<!DOCTYPE html>
<html>
[...]
<body>
<div id="outer-wrapper">
<header id="header" class="main-header clearfix">
<h1>
<img src="logo" src="[...]" alt="text goes here" />
</h1>
</header>
<div id="inner-wrapper">
[...]
</div>
</div>
</body>
</html>
But now, every page on my website has as its main title the text specified on the logo's alt
attribute, which I could imagine, is not ideal. I mean, the H1
tag is intended to provide the «main topic of the document», but that's most of the time not the text I specified on the logo's alt
tag.
However, if the logo's alt
tag contains the name of a company (because it's the comapanys logo), I would like to have it somewere in a heading (to give it some relevance and importance), just not in the h1
heading.
Do you think, the following is a valid solution for this problem:
<!DOCTYPE html>
<html>
[...]
<body>
<div id="outer-wrapper">
<header id="header" class="main-header clearfix">
<h2>
<img src="logo" src="[...]" alt="text goes here" />
</h2>
</header>
<div id="inner-wrapper">
<article>
<h1>Main topic</h1>
</article>
</div>
</div>
</body>
</html>