Tooltip in CSS?

P

Paul W

Hi - is there a way I can specify a tooltip (='title') value in a CSS?

Thanks,

Paul.
 
R

Ronx

A tooltip is an HTML construct, as in
<span title="this is a tooltip">Hover over this and see what happens</span>

The cursor is a display function and controlled by CSS, as in
<span style="cursor:help;">Hover over this and see what happens</span>

Combine the two:
<span title="this is a tooltip" style="cursor:help;">Hover over this and see
what happens</span>
 
G

George Hester

cursor is a style. But title is not. title is an attribute of a tag.
There are only a few things in CSS that can also be used as attributes of
tags. But title is not one of them. He\She can set a title with JavaScript
like this:

For IE browsers:

<!-- -->
<a id="oLink" href="apage.htm" title="1st Title">Click Me</a>
<!-- -->
<script language="javascript" type="text/javascript">
<!-- Begin
var oldTitle = '';
var newTitle = '';
var new_t = document.getElementById('oLink');
oldTitle = new_t.getAttribute('title',2);
newTitle = new_t.setAttribute('title','2nd Title');
// End -->
</script>
<!-- -->

http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/setattribu
te.asp?frame=true

Watch for line wrapping.
 
Top