Using a Single H1 Element to Include Logos in Web Pages
In this third part of a series, I demonstrate how easy it is to display a logo in a web page by using an H1 header element. This approach allows you to preserve the page's semantic meaning.
Using a Single H1 Element to Include Logos in Web Pages (Page 1 of 4 )
If you're a conscientious web designer who wants to learn how to display a logo in your website (or your client's) without sacrificing the pristine and semantic meaning of the structural markup, then look no further. In this article series I'm going to show you how to achieve that seemingly complex task by using a simple combination of common HTML elements, such as divs and H1 headers and a pinch of CSS.
Of curse, if you already had the chance to take a peek at the two previous installments of the series, then at this point you have a clear idea of how to semantically embed a logo in an (X)HTML document by utilizing a wrapping div along with an H1 element. This approach is very easy to implement and permits you to display the logo as a background image (instead of using an <img> tag), while its semantics are neatly preserved via the ID assigned to the containing div.
While the advantages to using a method like this become evident, the truth is that this approach can be enhanced even further. Considering that the wrapping div and the H1 header are both block-level elements, it's possible to get rid of the pertinent div (that sounds a bit cruel, I know) and use only the H1 tag to display the logo and preserve its semantic meaning at the same time.
Since implementing this improvement requires only a minor effort, in the next few lines I'm going to explain the theoretical aspects of this process. As usual, I will include a decent number of practical examples.
Ready to learn how to semantically include a logo in a web page using a single H1 element? Then begin reading right now!