Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

New line in title attribute? [duplicate]

Tags:

html

title

Possible Duplicate:
How can I use a carriage return in a HTML tooltip?

Currently if I want to insert a new line in title=, I would do this:

<span id="dummy" title="Hello
World!">Dummy</span>

Live demo: http://jsfiddle.net/DerekL/XFMfx/

But this looks really weird to me, and it just messes up my HTML file. Just imagine all those new lines in it.
So I'm wondering if there is a better way to achieve this, so that it won't mess it up.

Thanks.

like image 975
Derek 朕會功夫 Avatar asked Jan 05 '12 01:01

Derek 朕會功夫


People also ask

How do you insert a line break in title attribute?

If the title attribute's value contains "LF" (U+000A) characters, the content is split into multiple lines. Each "LF" (U+000A) character represents a line break.

How do you put a break in HTML?

To do a line break in HTML, use the <br> tag. Simply place the tag wherever you want to force a line break. Since an HTML line break is an empty element, there's no closing tag.


2 Answers

This is not possible. There are no cross-browser solutions. If you want a line break in your title attribute, you'll have to use JavaScript.

like image 153
animuson Avatar answered Nov 11 '22 05:11

animuson


As of Firefox 12 (which is the current Aurora version), this is (finally) supported. See the related bug.

like image 30
skittleys Avatar answered Nov 11 '22 05:11

skittleys