How can I use a carriage return in a HTML tooltip?
The latest specification allows line feed character, so a simple line break inside the attribute or entity
(note that characters #
and ;
are required) are OK.
It’s so simple you’ll kick yourself: just press Enter!
<a href="#" title='Tool
Tip
On
New
Line'>link with tip</a>
Try character 10. It won't work in Firefox though. :(
The text is displayed (if at all) in a browser dependent manner. Small tooltips work on most browsers. Long tooltips and line breaking work in IE and Safari (use
or
for a new newline). Firefox and Opera do not support newlines. Firefox does not support long tooltips.
http://modp.com/wiki/htmltitletooltips
Update:
As of January 2015 Firefox does support using
to insert a line break in an HTML title
attribute. See the snippet example below.
<a href="#" title="Line 1 Line 2 Line 3">Hover for multi-line title</a>