How do I add a tool tip to a span element?

MichaelICE picture MichaelICE · Jun 28, 2009 · Viewed 360.1k times · Source

In the following code, I want a tool-tip to come up when the user hovers the span, how do I do that? I don't want to use any links.

<span> text </span>

Answer

RichieHindle picture RichieHindle · Jun 28, 2009

Here's the simple, built-in way:

<span title="My tip">text</span>

That gives you plain text tooltips. If you want rich tooltips, with formatted HTML in them, you'll need to use a library to do that. Fortunately there are loads of those.