Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use a carriage return in a HTML tooltip?

I'm currently adding verbose tooltips to our site, and I'd like (without having to resort to a whizz-bang jQuery plugin, I know there are many!) to use carriage returns to format the tooltip.

To add the tip I'm using the title attribute. I've looked around the usual sites and using the basic template of:

<a title='Tool?Tip?On?New?Line'>link with tip</a> 

I've tried replacing the ? with:

  • <br />
  • &013; / &#13;
  • \r\n
  • Environment.NewLine (I'm using C#)

None of the above works. Is it possible?

like image 702
penderi Avatar asked Dec 11 '08 10:12

penderi


People also ask

How do you add a line break in HTML tooltip?

Just use the entity code &#013; for a linebreak in a title attribute.

How do I go to the next line in tooltip?

Solution 1 Yes - ToolTips obey "\r\n" characters and start on a new line. myObject. ToolTip = "Line 1\r\nLine 2\r\nLine 3"; will work fine.

How do you put a line break in a title tag?

You can use &#013; or &#010; .

What is carriage return in HTML?

The <br> HTML element produces a line break in text (carriage-return). It is useful for writing a poem or an address, where the division of lines is significant.


2 Answers

The latest specification allows line feed character, so a simple line break inside the attribute or entity &#10; (note that characters # and ; are required) are OK.

like image 189
Kornel Avatar answered Oct 06 '22 07:10

Kornel


It’s so simple you’ll kick yourself: just press Enter!

<a href="#" title='Tool Tip On New Line'>link with tip</a>
like image 22
Greg Avatar answered Oct 06 '22 06:10

Greg