tags:

views:

4095

answers:

5

I'd like to know if it's possible to force a newline to show in the tooltip when using title property of a TD. something like

<td title="lineone \n linetwo \n etc...">

Can this be done?

+1  A: 

This should be ok, but is IE specific:

<td title="lineone
linetwo 
etc...">

As others have mentioned, the only other way is to use and HTML + JavaScript based tooltip if your only interested in the tooltip. If this is for accessibility then you will probably need to stick to just single lines for consistancy.

Ady
I can confirm that this doesn't work. Thanks
In what context?
Ady
sorry, i realise that my question wasn't very descriptive of the solution i was looking for...I'm looking for a way for newlines to show up on the tooltip, i tried this and it doesn't work in IE or firefox.
Appologies, this should work OK for internet explorer, however I just checked with FireFox, and it looks like the line breaks are ignored.
Ady
Apologies again, as it does indeed work in IE, but not firefox
+1  A: 

If you're looking to put line breaks into the tooltip that appears on mouseover, there's no reliable crossbrowser way to do that. You'd have to fall back to one of the many Javascript tooltip code samples

Gareth
+4  A: 

Works with IE but not FF.

Try a Javascript Tooltip library for a better result, something like OverLib

RealHowTo
+1  A: 

I use the jQuery clueTip plugin for this.

tvanfosson
A: 

The Extensible Markup Language (XML) 1.1 W3C Recommendation say

« All line breaks MUST have been normalized on input to #xA as described in 2.11 End-of-Line Handling, so the rest of this algorithm operates on text normalized in this way. »

The link is http://www.w3.org/TR/2006/REC-xml11-20060816/#AVNormalize

Then you can write :

<td title="lineone &#xA; linetwo &#xA; etc...">
harobed
Instead of the line breaks, spaces are displayed in Firefox.
Propeng