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.
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.
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.
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.
As of Firefox 12 (which is the current Aurora version), this is (finally) supported. See the related bug.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With