Making Header Image Clickable Link
By Jeremy Clark
tips |
css, header, image, tips | 5,256 views
Sometimes a text header link just doesn’t cut it. Making a image a clickable header link is very simple. You can see the result above, the area around the name in the image is a link back to the home page.
Here is the basic layout of the code.
<div id="header"><a href="http://www.your-link-to-your-home" id="headerlink"></a></div>
Notice that the actual link doesn’t contain any text so when it’s render by the browser there would be nothing to display and the link wouldn’t show up. That is fixed in the CSS.
#header{
background:url(images/header.jpg) no-repeat bottom left;
height:100px
width:100%;
}
#headerlink{
display:block;
width:100px;
height:100px;
margin:20px 0 0 20px;
}
This will make a 100px X 100px square link that is 20px from the top of the header and 20px from the left. As for most styling it will require some trial and error to get it positioned just right.
Related posts:



| (8 votes, average: 4.50 out of 5)
Seonaid
Jul 20th 2011 @ 8:03 amBrilliant, thank you.
Anthony
Oct 6th 2011 @ 2:53 amGreat help. I was able to make my headerimage linkable. That’s one thing that went right for me today in the realm of creating websites. Been trying to add a slideshow, but no luck for two days now. By the way, that reminds me. I want to let everyone know that Steve Jobs passed away today. What a great loss.
Anyway, thank you.
Becs
Nov 26th 2011 @ 6:50 pmThis is great thank you. Is possible to add a 2nd and 3rd link within the header. I have tried creating a new style and can get the link to work, but positioning it doesn’t seem to work with the margins (i.e will only appear below the 1st header link)