Welcome to WebmasterWorld Guest from 54.204.189.167

Forum Moderators: incrediBILL

Message Too Old, No Replies

How to put a line break in a tooltip?

title attribute for an a element

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

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Nov 26, 2003
posts:1133
votes: 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:

Exemplary
website

How do I do that?

Hope to hear from you
Michal Cibor

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

didn't work.

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

Full Member

10+ Year Member

joined:Feb 18, 2005
posts:262
votes: 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 Sept 8, 2005 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Nov 26, 2003
posts:1133
votes: 0


Shacks!

What a shame...

Thanks anyway!

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

Full Member

10+ Year Member

joined:Feb 24, 2004
posts:219
votes: 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 Sept 8, 2005 (gmt 0)

Full Member

10+ Year Member

joined:Feb 18, 2005
posts:262
votes: 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 Sept 8, 2005 (gmt 0)

Full Member

10+ Year Member

joined:Dec 10, 2001
posts:254
votes: 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:
<...title="Exemplary&#13;website">

(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 Sept 8, 2005 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Dec 17, 2001
posts:1262
votes: 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 Sept 8, 2005 (gmt 0)

Full Member

10+ Year Member

joined:Dec 10, 2001
posts:254
votes: 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 Sept 8, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:Dec 29, 2004
posts:96
votes: 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 Sept 9, 2005 (gmt 0)

New User

10+ Year Member

joined:Sept 5, 2005
posts:9
votes: 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 Sept 9, 2005 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Nov 26, 2003
posts:1133
votes: 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