Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tooltips: SPAN title and new lines? 2

Status
Not open for further replies.

srudin

Programmer
Jan 1, 2002
32
0
0
CH
hi

i usually make tooltips like this:

<SPAN title=&quot;Tooltip&quot;>some text</SPAN>

that works fine; but now i got a tooltip where i would like to insert a new line, for example:

<SPAN title=&quot;Tooltip1<BR>Tooltip2&quot;>some text</SPAN>

Unfortunately that doesn't work, since Tags are not accepted inside another tags property... is there an easy solution for this?

any help appreciated
 
:)))
it does

i din't even thought of checking this since it usually doesn't has any effect...

thanx
 
This might be a little neater:

Code:
<!DOCTYPE html 
     PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;
     &quot;[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;>[/URL]

<html xmlns=&quot;[URL unfurl="true"]http://www.w3.org/1999/xhtml&quot;[/URL] xml:lang=&quot;en&quot; lang=&quot;en&quot;>
  <head>
    <meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;></meta>
    <title>JavaScript Sample</title>
  </head>
  <body>
    <span title=&quot;toasted&amp;#013fish&amp;#013on&amp;#013bread&amp;#013-----&amp;#013whiskey&amp;#013-----&amp;#013otter pops&quot;><p>Hover over me for today's menu.</p></span>
  </body>
</html>

Cheers,


[monkey] Edward [monkey]

&quot;Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!&quot; -- inventor of the cat door
 
Well...

Sure, I replaced the line breaks with an actual linefeed character entity, which is 4 characters more per desired line break.

Maybe it's a style/personal thing. Using line breaks just seems kinda hackish to me, like taking advantage of a browser flaw or something. Character entities seems like the generic tool and this is just one implementation of them.

But whatever works, too. [smile]

Cheers,


[monkey] Edward [monkey]

&quot;Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!&quot; -- inventor of the cat door
 
Check out this page:

Worth looking at with a couple of browsers to see the difference - I checked with IE6 and NN7 on W2K.

The deal with line breaks in tooltips (using title=&quot;&quot; attribute) is that according to the HTML standard a line break should count as a space - in fact ANY amount of consecutive spaces, tabs, and line breaks count as exactly ONE space. You've seen this behaviour in normal HTML markup:
[tt]<input *
type=&quot;...
[/tt] (note * = line break)
is the same as:
[tt]<input type=&quot;...[/tt]
It should work the exact same way for title=&quot;&quot; tooltip text. So IE is incorrectly showing a line break in the tooltip text.

Conclusion: It may work now (in IE), but it isn't guaranteed to continue working in the future.
(if the next version of IE suddenly became standards-compliant .. :p)

Other reading:
and

Posting code? Wrap it with code tags: [ignore]
Code:
[/ignore][code]CodeHere
[ignore][/code][/ignore].
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top