Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hyperlinking <div> tags 1

Status
Not open for further replies.

realtree

Technical User
Aug 5, 2003
53
CA
I found a way to link my logo to my homepage when using css, but the finger cursor doesn't appear when hovering the link. Is there a better way to do this? I didn't make site or the css myself, and I don't want to restructure the whole thing if I can help it.

in my top frame:
Code:
<a href="index.html" target="_top">
<div id=top>
</div>
</a>

in my css:
Code:
#top {
	position:absolute;
	top:0px;
	left:0px;
	width:290px;
	height:100px;
	background:url(images/logo.gif) left no-repeat;
	z-index:10;
	}
 
Try something like this:

Code
Code:
<div id="Top">
  <h1><a href="index.html"><span>Logo</span></a></h1>
</div>

CSS
Code:
#Top h1
{
  margin: 0;
  padding:0;
  width: 290px;
  height:100px;
  background-image: url(images/logo.gif);
  background-repeat: no-repeat;
}

#Top h1 span
{
  font-size: 1px;
  visibility: hidden;
}

#Top h1 a
{
  display:block;
  margin: 0;
  padding:0;
  border: 0;
  width: 290px;
  height:100px;
}

You might need to change it to your own requirements, but basically it should work. Also, browsers that don't use CSS will display something as a heading instead.

The technique is called Fahrner Image Replacement, after Todd Fahrner, and is discussed at length at these links:

 
hmm, that simple eh?

Thanx ChrisHirst, that works just fine.

bluark: thanks anyway, but I don't understand css all too well, and I'd rather not mess with the original design too much.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top