<acronym> new line

J

John

Hi

<acronym title="apple pie custard tart">desserts</acronym>

Is there any way I could place a line feed after pie so I get

apple pie
custard tart

on two lines

Regards
John
 
J

Jukka K. Korpela

Scripsit John:
<acronym title="apple pie custard tart">desserts</acronym>

Is there any way I could place a line feed after pie so I get

apple pie
custard tart

on two lines

What you really want is a line break in the tooltip that you expect browsers
to show on mouseover. The answer is that you can't achieve that in any
reliable manner. Putting a line break in the source,

<acronym title="apple pie
custard tart">desserts</acronym>

may make some browsers do what you want, but this is really a browser _bug_.
It violates HTML rules that say that a line break inside an attribute value
is equivalent to a space.

What are you trying to achieve, anyway? The word "desserts" ain't no
acronym, so <span> would be the proper markup. But tooltips created by title
attributes are a lousy way of presenting information, except in special
cases where users can be expected to know about them.
 
A

Art

Scripsit John:


What you really want is a line break in the tooltip that you expect browsers
to show on mouseover. The answer is that you can't achieve that in any
reliable manner. Putting a line break in the source,

<acronym title="apple pie
custard tart">desserts</acronym>

may make some browsers do what you want, but this is really a browser _bug_.
It violates HTML rules that say that a line break inside an attribute value
is equivalent to a space.

What are you trying to achieve, anyway? The word "desserts" ain't no
acronym, so <span> would be the proper markup. But tooltips created by title
attributes are a lousy way of presenting information, except in special
cases where users can be expected to know about them.
Scripsit John,

You can try placing an encoded line feed into the title:

<acronym title="apple pie
custard tart">

although this isn't universally recognized by all browsers for
tool-tips. Firefox, IE, and Safari do. Opera and Seamonkey don't
(treats it as a space).

Although the line feed isn't an HTML named entity
(http://www.w3.org/TR/html401/sgml/entities.html), browsers historically
have recognized this numerical encoding method.

Jukka's suggestion of using a <span> element will work. However, unlike
the <acronym> element, there is no indication to the viewer (no dotted
underline or other decoration by the browser) that there is anything
additional information available about this word.

Thus, a unique CSS style/class would need to be created for these
<span>'s to flag the user that there is additional information available
via tool-tip for the word. You could put a global message on your page
to that effect.

Art
 
J

Jonathan N. Little

Art said:
You can try placing an encoded line feed into the title:

<acronym title="apple pie
custard tart">

although this isn't universally recognized by all browsers for
tool-tips. Firefox, IE, and Safari do. Opera and Seamonkey don't
(treats it as a space).

Although the line feed isn't an HTML named entity
(http://www.w3.org/TR/html401/sgml/entities.html), browsers historically
have recognized this numerical encoding method.

You didn't try this did you? It isn't recognized at all in a title
attribute for any browser that I know of including FF and Opera... Now
on Windows system
(LF+CR)works with Gecko and IE but not on
Opera... Doesn't work with FF on Linux but does with Konqueror... spotty
at best.
Jukka's suggestion of using a <span> element will work. However, unlike
the <acronym> element, there is no indication to the viewer (no dotted
underline or other decoration by the browser) that there is anything
additional information available about this word.

Agree, dessert is not an acronym.
Thus, a unique CSS style/class would need to be created for these
<span>'s to flag the user that there is additional information available
via tool-tip for the word. You could put a global message on your page
to that effect.

Sill idea but CSS popup would work and degrade where the information
would be availably to the user...

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<meta http-equiv="content-language" content="en-us">
<title>CSS balloon</title>

<style type="text/css">
..balloon { position: relative; border-bottom: 1px dashed #0f0; }
..balloon span {
display: block; position: absolute;
top: .5em; left: -100em; /* push out of view*/
border: 1px solid #000; padding: .25em;
color: #000; background-color: #ffd;
white-space: nowrap; /* prevent wrapping except where you specify */
}

..balloon { behavior: url(IEFixes.htc); } /* IE hover attachment */
..balloon:hover span,
..balloon.hover span { left: 1em; } /* move into viewport */

</style>
</head>

<body>
<p>One way is with a CSS styled element <span class="balloon">
<span>apple pie<br>custard tart</span>desserts</span>,
would work. For <span title="12
345">IE</span> you will have to
use a bit of JavaScript
or HTC file hack.
</p>
</body>
</html>


and the HTC file:

<public:component>
// For MSIE use JScript to attach JS functions to compensate
// for missing pseudo-class support
// from Vladdy http://www.vladdy.net/Demos/IEPseudoClassesFix.html
// updated for html4.01 jnl 3/06
<public:attach event="onmouseover" onevent="DoHover()">
<public:attach event="onmouseout" onevent="RestoreHover()">
<public:attach event="onmousedown" onevent="DoActive()">
<public:attach event="onmouseup" onevent="RestoreActive()">
<script type="text/jscript">
function DoHover(){
element.className += ' hover';
}
function DoActive(){
element.className += ' active';
}
function RestoreHover(){
element.className = element.className.replace(/\shover\b/,'');
}
function RestoreActive(){
element.className = element.className.replace(/\sactive\b/,'');
}
</script>
</public:component>
 
H

Harlan Messinger

Jonathan said:
You didn't try this did you? It isn't recognized at all in a title
attribute for any browser that I know of including FF and Opera... Now
on Windows system
(LF+CR)works with Gecko and IE but not on
Opera... Doesn't work with FF on Linux but does with Konqueror... spotty
at best.

The Windows line separator is CR + LF, not the other way around.
 
B

Blinky the Shark

Art said:
Scripsit John,

You can try placing an encoded line feed into the title:

<acronym title="apple pie
custard tart">

although this isn't universally recognized by all browsers for
tool-tips. Firefox, IE, and Safari do. Opera and Seamonkey don't
(treats it as a space).

I'm still trying to figure out why anyone would treat "desserts" as an
acronym.
 
A

Art

You didn't try this did you? It isn't recognized at all in a title
attribute for any browser that I know of including FF and Opera... Now
on Windows system
(LF+CR)works with Gecko and IE but not on
Opera... Doesn't work with FF on Linux but does with Konqueror... spotty
at best.
Yes :).

To clarify, the results for Firefox, Opera, Safari, and Seamonkey were
observed on a Mac. IE6 was observed under W2K. However, I mistakenly
transcribed the Seamonkey and Firefox results: Works on Seamonkey,
yields a single space on FF.

On IE6, the CR is ignored, the LF is sufficient.

Opera ignores the LF and maps the CR to a space.

Actually, encoding a LF/CR combination on Safari results in TWO line feeds.

I saw the same title behavior with both <acronym> and <span>.

Your results on Linux re-enforces my original statement - this encoding
isn't universally recognized by all browsers for tool-tips.

Thus, the LF/CR encoding with either <acronym> or <style> elements would
satisfy the OP request if the browser and platforms can be limited.

Not to fan the flames, but the fact that it does work as desired with
just LF encoding on IE6 on the PC somewhat increases the chance that a
user will observe the intended results :).

Art
 
H

Harlan Messinger

Art said:
To clarify, the results for Firefox, Opera, Safari, and Seamonkey were
observed on a Mac. IE6 was observed under W2K. However, I mistakenly
transcribed the Seamonkey and Firefox results: Works on Seamonkey,
yields a single space on FF.

On IE6, the CR is ignored, the LF is sufficient.

Opera ignores the LF and maps the CR to a space.

Actually, encoding a LF/CR combination on Safari results in TWO line feeds.

I saw the same title behavior with both <acronym> and <span>.

Your results on Linux re-enforces my original statement - this encoding
isn't universally recognized by all browsers for tool-tips.

Thus, the LF/CR encoding with either <acronym> or <style> elements would
satisfy the OP request if the browser and platforms can be limited.

AFAIK the LF + CR combination isn't the line separator on any operating
system. The combination you should be testing is CR + LF.
 
N

nice.guy.nige

While the city slept, Blinky the Shark ([email protected]) feverishly
typed...

[...]
I'm still trying to figure out why anyone would treat "desserts" as an
acronym.

<acronym title="Delicious Eclairs, Shortbreads, Sorbets, Extra-Rich Tortes
and Souffles">desserts</acronym> ;-)

Cheers,
Nige
 
A

Art

AFAIK the LF + CR combination isn't the line separator on any operating
system. The combination you should be testing is CR + LF.
My results with CR/LF are the same with the exception that on Safari
either a CR or CR/LF sequence does result in two lines of text where
LF/CR resulted in one line, a blank line and a the second line.

FWIW - The Mac uses CR as a line separator in text files. AFAIK,
Unix/Linux uses LF, Windoze uses the CR/LF combination.
 
B

Blinky the Shark

nice.guy.nige said:
While the city slept, Blinky the Shark ([email protected]) feverishly
typed...

[...]
I'm still trying to figure out why anyone would treat "desserts" as an
acronym.

<acronym title="Delicious Eclairs, Shortbreads, Sorbets, Extra-Rich Tortes
and Souffles">desserts</acronym> ;-)

Oh yeah, I forgot about that... :)
 
J

John

Hi, all

Many thanks for the many replies.

Yes, I know, desserts is not an acronym . It was just an example. Don't
get excited it's only for fun.

Now, the &13;&10; work well in IE but not in FF. So I'm half way there.
The site should work in both.
Other browsers I don't really care about.

Is <acronym> the best to use? In this case it is.

Many thanks, again, folks.

Regards
John
 
B

Blinky the Shark

John said:
Hi, all

Many thanks for the many replies.

Yes, I know, desserts is not an acronym . It was just an example. Don't
get excited it's only for fun.

Who's excited?
 
J

Jukka K. Korpela

Scripsit John:
Many thanks for the many replies.

Unfortunately it seems that you have missed or ignored most of their best
content.
Yes, I know, desserts is not an acronym . It was just an example.

When you present an example, a manifestly bad example is usually
symptomatic - a good example of what you're doing, though.
Now, the &13;&10; work well in IE but not in FF.

The character references, when written correctly, denote a line break, which
is incorrectly treated by IE as causing a line break in visual rendering and
treated correctly as equivalent to a space by FF, and treated in various
confusing and partly funny ways by some older browsers.

It's no different from an actual line break, except that it may look like
cool technospeak and obfuscates your markup a bit.

I actually explained this already, in somewhat different words.
So I'm half way there.

What should you do if you are half way digging yourself down into a deep
hole?
Other browsers I don't really care about.

Such as IE 8, which may well fix the current IE bug, right?
Is <acronym> the best to use? In this case it is.

Of course not. Especially if you have to ask, <acronym> is not the right
element.

If you just want to entertain yourself with tiny popup windows on mouseover,
on both of the browsers you know, then use a piece of CSS and JavaScript (or
maybe just CSS), giving you _much_ better options. Then there's no reason to
use <acronym> of course. You can use <a>, it's faster to type!

If you wish to present some content in a useful way, it's a different story,
and you haven't even started telling about it yet.
 
J

Jonathan N. Little

<acronym>title="apple pie<br>custard tarts<br>desserts"</acronym>

Firstly, PLAIN TEXT for newsgroups please.

Secondly, your suggestion will not work as you expect, HTML markup will
not be interpreted within an attribute value so you will get a tooltip
with literally "apple pie<br>custard tarts<br>desserts" and not new lines.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top