Tooltip in CSS?

  • Thread starter Thread starter Paul W
  • Start date Start date
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>
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Excel Tooltip on listview in a VBA for Excel 1
multi-line tooltips in Navigator 5
tooltip 3
Tooltip format 1
Frontpage 2003 and external CSS 1
CSS web page design 3
Tooltip "stay up" time... 2
css help 1

Back
Top