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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hover text over link

Status
Not open for further replies.

ralphtrent

Programmer
Jun 2, 2003
958
US
Hello
I would like to show a description of what the link is when a user hovers over the link, I think this can be done in CSS, but I am not sure. Can anyone help?

Thanks
 
It can be done in html.
Code:
<a href="[URL unfurl="true"]http://www.google.com/"[/URL] title="That one famous search engine">Google</a>

___________________________________________________________
[small]Do something about world cancer today: PACT[/small]
 
Hi

Yes, can be CSS too, like below :
Code:
<html>
<head>
<title></title>
<style type="text/css">
span.info span {
  position: absolute;
  display: none;
  color: darkblue;
  background-color: #eee;
  border-style: outset;
  border-width: 2px;
  padding: 5px;
}
span.info:hover span {
  display: inline;
}
</style>
</head>
<body>
<span class="info">Shrek<span>big green guy</span></span> loves <span class="info">Fiona<span>big green girl</span></span>
</body>
</html>
Works in FireFox, Opera, Safari and probably Konqueror. Of course does not work in Explorer 6, but maybe works in Explorer 7. But for Explorer you can add a behavior script to work identically with the others.

So better choose a solution which involves JavaScript. You can google for "javascript tooltip", for example.

Feherke.
 
I Second Vrag. For just a text description, the title attribute is the best choice.

----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
And if you want feherke's solution and since you do mention links, you can change the outer span to be an anchor element (<a>) and then the custom CSS tooltip will work on IE6 as well. Without any Javascript.

___________________________________________________________
[small]Do something about world cancer today: PACT[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top