How to Add a Line Break to a Tooltip

by Updated June 1, 2018

It's possible to add line breaks to a HTML ToolTip tag.  To add the line break simply use either the 
 entity or in some cases the \n escaped newline character will work.

In a regular HTML page the ToolTip title tag would look like the following when creating a line break:

-----------------------------------------------

title="First: We will break the line here 
 Second: then continue on this line."

-----------------------------------------------

 

In ASP.NET, the tooltip line break uses \n and would look like this:

-----------------------------------------------

ToolTip="First: We will break the line here \n Second: then continue on this line."

-----------------------------------------------

 

I have only tested this in Internet Explorer 7, so you will want to test this out in Firefox and Safari as well. To test Hover Over This.

Keep in mind there may be a limit to the number of characters you can have in a Tooltip.
 

 

 


0
6

6 Comments

anonymous by Amy on 7/22/2008
Doesn't work in my Firefox 3. The entire tooltip shows up on one line.
anonymous by Doğan on 1/9/2009
Line Breaks in flex...
In flex ide, you can do this with toolTip="Hello
World". But you must use code editor. If you do this with Flex Properties panel, flex converts & char to &amp naturally for xml compability. Use code editor :)
anonymous by Jordi Camps on 4/22/2009
Well, I didn't manage to get the \n working. The 
 separator did work, as proposed by Dogan (from ASP.NET in my case).

But the above only works in IE... it looks like it's impossible to add line breaks in standard tootips in Firefox. The good thing about the 
 solution is that it is transparent in Firefox (no line break but, at least, no other strange chars!)
anonymous by Enrique on 4/27/2010
Thanks. That really helped.

 worked in Google Chrome
anonymous by buddy on 6/8/2011
\r\n also works on chrome (didnt even test \n alone)
anonymous by Charlie on 6/17/2011
Thanks Buddy

Add your comment

by Anonymous - Already have an account? Login now!
Your Name:

Comment:
Enter the text you see in the image below
What do you see?
Can't read the image? View a new one.
Your comment will appear after being approved.

Related Posts


If you want to disable the Content Advisor in Internet Explorer, but have forgotten the required password needed to turn Content Advisor off, don't fret. You can easily solve this Content Advisor password issue quickly by making a simple edit to the...  more »

Adding a CSS border to an ASP.NET Image control was a mystery to me for the longest time. While you could easily use an html image and add the runat="server" to it and then add CSS, I really wanted to use an asp:Image control along with a CSS border....  more »

Google's Gmail is great right? And you always get your legitate email messages sent to your inbox, and receive no spam right? Well, I'd like to think that was the case, but unfortunately Google runs a tight spam filter that will occassionally put emails...  more »

Creating a new group on Facebook is easier than you think. To create a new Facebook group simply login to your Facebook account and then go to the following URL: http://www.facebook.com/groups/create.php Fill out the Group Name and all the groups details,...  more »

Blocking your ads from displaying on crappy sites that don't convert is an essential part of Pay Per Click (PPC) advertising. It's especially important if you're doing Pay Per Click (PPC) advertising with Yahoo Search Marketing since they tend to show...  more »

There are different tools of search engine optimization that help web pages to appear higher up in the search engine rankings. One of these methods is link building, the aim of which is to increase the number of inbound links to pages on a website, thus...  more »

So are you wondering who favorites your tweets from twitter, or who favorited the same tweets as you favorited? Well there's actually a few cool favorite sites that you can use to discover who is favoriting your tweets. It can be pretty interesting and...  more »

Having your Facebook account hacked by some nefarious hacker would be the last thing any one really needs to deal with. About a year ago or so, a dating website got hacked into and the sites username passwords weren't encrypted in the database. These...  more »

If you use Windows Live Hotmail, at some point you may want to add an email address or domain to your safe senders list (whitelist). This will insure that you will continue to receive emails from the sender's address without the them going to the spam or...  more »

Google Adwords makes it extremely easy to export your Adwords Campaign into another advertising network. Google allows you to download an export .CSV file of your Adwords Account, Campaigns or Adgroups to your computer, which you can then easily upload...  more »

Last year our “How to setup a compliant Facebook contest” article described the guidelines of contests on Facebook pages. In the meantime, Facebook changed their rules for contests organized on business pages. Recently a lot of small...  more »

In just a few steps, PayPal makes it really simple for you to create product buy now buttons or links for websites and email. Follow these steps to create a 'Buy Now' Paypal link: Log into your PayPal account. Click on the 'Merchant Services' tab, then...  more »