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


A Facebook Page is a public profile that allows you to share your business, products, favorite artist or public figure with Facebook users. Facebook makes it easy to create a "fan" page in just a few minutes Here's how you can create a Facebook fan page:...  more »

Many modern websites today use Javascript and require it to be enabled in your browser for you to experience the full features of a site. Learn how to turn on or off Javascript in your Internet Explorer 6.x browser.  more »

Here's how you can create a Twitter status link, so users can quickly retweet your message from a hyperlink on your website.  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 »

A lot of social bookmarking sites are now iFraming in other websites, in order to keep traffic on their site so they get more pageviews. In order to get around the HTML iFraming of your site, below is a little javascript code that will automatically get a...  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 »

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 »

Here's how to start Firefox in Safe Mode in Windows 7 (or Windows Vista): If Firefox is open, close down Firefox completely. In Windows 7 (or Vista), click Start, then click All Programs. and Navigate to the 'Mozilla Firefox' folder and select the Mozilla...  more »

In this tutorial, we'll look at how to set up automated reports scheduling in a Yahoo! Search Marketing account. The purpose of setting up reports scheduling is to have your Yahoo Pay Per Click stats sent directly to your email inbox, thus saving you time...  more »

You may be wondering where the search box went to in Internet Explorer 9. If you were previously using IE8, or Firefox, you're probably accustomed to seeing the search box in the upper right-hand side of the browser window. Well that's all changed in IE9,...  more »

Amazon Prime Day 2017 has finally arrived and now we have a first hand look at many of the days featured deals. Most of these Prime Day deals will not be live until 9 pm on July 10th and will run through July 11th, so take advantage of them while they...  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 »