homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

How to put a line break in a tooltip?
title attribute for an a element

 1:27 pm on Sep 8, 2005 (gmt 0)

Hi all!

I have a small problem. I want to display text on mouse over a link, so I use this structure:

<a href="http://www.example.com" title="Exemplary website"> - works fine</a>

However I want to put a line break inside a title to display it as:


How do I do that?

Hope to hear from you
Michal Cibor

PS. <a href="#" title="New
<a href="#" title="New<br>line">

didn't work.



 1:41 pm on Sep 8, 2005 (gmt 0)

As far as I'm aware there is no defined way to cause a line break in ALT text. I have been waiting to find an answer to this myself..


 1:49 pm on Sep 8, 2005 (gmt 0)


What a shame...

Thanks anyway!


 2:01 pm on Sep 8, 2005 (gmt 0)

The title attribute may be set for both A and LINK to add information about the nature of a link. This information may be spoken by a user agent, rendered as a tool tip, cause a change in cursor image, etc.

The browser supports plain text rather than html. I don't think you can add linebreak to it.


 2:03 pm on Sep 8, 2005 (gmt 0)

Probably no use to you/bore you silly but its a hugh amount of info about ALT tags..

ALT tags [htmlhelp.com]


 7:32 pm on Sep 8, 2005 (gmt 0)

This question was answered in this very forum about seven weeks ago.

There are two approaches:

1) Use the character entity for a carriage return, which is &#13; Thus:

(For a full list of character entities, try Googling "HTML Character Codes".)

2) to do any additional styling to your "tooltips", Google "CSS tooltips"


 7:39 pm on Sep 8, 2005 (gmt 0)

While inserting the entity for a carriage return/linefeed (&#xD; or &#xA;) will produce the desired result in Internet Explorer for Windows, it is not part of any standard and is not supported, for instance, by Gecko browsers on Windows. I have not tested other platforms.


 7:55 pm on Sep 8, 2005 (gmt 0)

it is not part of any standard and is not supported, for instance, by Gecko browsers on Windows

That is true. . . and a pity. I guess if you really must have the conrol, you must resort to option #2, CSS Tooltips (or to Javascript e.g., overlibmws.js.)


 10:55 pm on Sep 8, 2005 (gmt 0)

A floating element may be more like what you want, can put in a nice icon and styled text in it too for example.

Easy to achieve with javascript.


 2:09 am on Sep 9, 2005 (gmt 0)

Why not just give goth words their own link?
i.e. <a href="mysite.htm">My</a><br /><a href="mysite.htm">Website</a>
If there is another way around this I don't know of one but this should give you the same effect. Or if you really need to have the information split across rows just shorten the width (css or td cell) so it will have no choice but to word wrap across two lines.


 4:00 pm on Sep 9, 2005 (gmt 0)

Because the alt text is just more info about sth:

In this example it's more info about the person online:

<a href="person.html?id=212" title="More info &#13 and even more info">Andrew Watson</a>

You see why is that?

The link is short because it's a list.

If anybody knows Andrew Watson it's not him :)

Thanks guys for the answer! To know that sth cannot be done is also information.

Best regards
Michal Cibor

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved