Use of acronym and abbr tags with anchors

R

Rowan Malin

Hi folks,

This is (I think) my first posting to this group, so please accept my
apologies if the question is inappropriate. I'd like to know what the
'correct' or 'preferred' approach is (if any) for defining anchor tags whose
contents are solely abbreviations or accronyms. For example, should I write:
<a href="x"><acronym>HTML</acronym></a>

or:
<acronym><a href="x">HTML</a></acronym>
?

(BTW - I don't want to get into a fight over what is or is not an acronym!
Use <abbr> if you prefer.)

On a related note (and again, forgive me if this should be asked elsewhere),
I notice that some browsers default-render the above with *both* underline
and under-dottedline which, in my opinion, looks odd. What would be the
suggestions of the group regarding the preferred suggested rendering (using
CSS, of course)?

Cheers,
Rowan
 
N

Neal

I'd like to know what the
'correct' or 'preferred' approach is (if any) for defining anchor tags
whose
contents are solely abbreviations or accronyms. For example, should I
write:
<a href="x"><acronym>HTML</acronym></a>

or:
<acronym><a href="x">HTML</a></acronym>
?

I'd put the anchor inside any markup, but that's just me. Neither is
wrong, but as a matter of habit I'd do it that way.
I notice that some browsers default-render the above with *both*
underline
and under-dottedline which, in my opinion, looks odd.

Which browsers actually use a dotted line under abbr? Right now I have
Mozilla 1.6, IE 6 and Opera 7.23 open and none render anything for abbr or
acronym.
 
J

Jukka K. Korpela

Neal said:
Which browsers actually use a dotted line under abbr? Right now I
have Mozilla 1.6, IE 6 and Opera 7.23 open and none render anything
for abbr or acronym.

I haven't checked the situation lately, but e.g. Firefox uses a dotted
line under both abbr and acronym if (and only if) the element has a title
attribute.
 
T

Toby A Inkster

Rowan said:
<a href="x"><acronym>HTML</acronym></a>
or:
<acronym><a href="x">HTML</a></acronym>

I'd tend to go with the former. My reasoning? Consider for example a
browser that rendered the <acronym> element like:

ACRONYM (Full Expansion).

Then the two segments of code you posted would be (where [...] indicates a
link):
[HTML (Hypertext Markup Language)]
and:
HTML:
 (Hypertext Markup Language)

It just seems a more logical way of doing things.

But it's not really important. Either way is right. My way is just more
right. ;-P
 
J

Jukka K. Korpela

Rowan Malin said:
I'd like to know what the
'correct' or 'preferred' approach is (if any) for defining anchor
tags whose contents are solely abbreviations or accronyms.

For
example, should I write:
<a href="x"><acronym>HTML</acronym></a>

or:
<acronym><a href="x">HTML</a></acronym>
?

Both are valid, and there is no known difference in their effects, except
when style sheets assign properties to <acronym> in a manner that may
conflict with the default or styled presentation of <a>.

For example, suppose a user style sheet sets
acronym { background: yellow; color: purple; }
(which _might_ be sensible, for highlighting purposes
In the first case, the background color for <acronym> hides the link
underline and makes the link text purple, irrespectively of the state of
the link, since it's primarily <acronym> text and takes its color
accordingly.

For such reasons, I have usually recommended that when <a href> elements
are nested with other text level markup, the <a href> markup is
(BTW - I don't want to get into a fight over what is or is not an
acronym! Use <abbr> if you prefer.)

Well, if it is unclear whether HTML is an acronym or an abbreviation,
what's the point of using <acronym> or <abbr> markup for it? That is,
what is the expected _gain_ from using the markup? For example,
do you wish to hear a speech browser try to pronounce "HTML" as a word?

The "fight" _is_ the most relevant question. And since there is no
consensus, there is normally no reason to use either markup, except
perhaps in specialized cases (e.g., a special application in an intranet
where you can explain to users what the dotted lines mean, etc.). More on
this: http://www.cs.tut.fi/~jkorpela/html/abbr.html
On a related note (and again, forgive me if this should be asked
elsewhere), I notice that some browsers default-render the above with
*both* underline and under-dottedline which, in my opinion, looks
odd.

To the extent that the dotted underline is useful at all (which I doubt),
it's useful also when there is a link underline. If it acts as a signal
saying "here's an abbreviation/acronym for which some explanation is
available if you put the cursor on it", then this would say just the same
thing even when there's another presentational idiom saying "here's a
link".

However, note that if both elements have a title attribute, browsers seem
to use just one of those attributes. For example, if you have

<acronym title="HyperText Markup Language">
<a href="http://www.w3.org/Markup" title=
"HyperText Markup Language (HTML) Home Page - W3C's HTML Activity">
HTML</a></acronym>

then browsers that I tested now show the title of <a href> as tooltip and
ignore the title of <acronym>. That is, they use the title of the
innermost element. But I remember vaguely having seen the opposite
behavior too. Anyway, there's usually no point in using title attributes
that way, since it's better that the author decides which attribute is
more essential. But if e.g. some HTML-generating software creates markup
that may have nested elements with title attributes, it is generally best
to make it put <a href> innermost for this reason too - the title of
<a href> is usually more important and useful than other title
attributes.

What would be the suggestions of the group regarding the
preferred suggested rendering (using CSS, of course)?

Technically, the dotted underline is a bottom border in CSS terms, so you
can suggest suppressing it by using e.g.

acronym.with-link { border-bottom: none; }

and <acronym class="with-link" ...><a href=...>...</a></acronym>. There's
currently no selector in CSS that would mean 'acronym elements containing
a elements'. Contextual selectors work the other way around. If you used

<a href=...><acronym ...>...</acronym></a>

(despite the arguments above), then you could use simply

a:link acronym, a:visited acronym { border-bottom: none; }
 
R

Rowan Malin

Neal said:
I'd put the anchor inside any markup, but that's just me. Neither is
wrong, but as a matter of habit I'd do it that way.


Which browsers actually use a dotted line under abbr? Right now I have
Mozilla 1.6, IE 6 and Opera 7.23 open and none render anything for abbr or
acronym.

Thanks for the advice. Your not seeing the dotted line puzzles me - I see it
on both Mozilla 1.4 and Opera 7.23 (on Linux), but not on IE 6.
 
R

Rowan Malin

Jukka K. Korpela said:
[snip]
For
example, should I write:
<a href="x"><acronym>HTML</acronym></a>

or:
<acronym><a href="x">HTML</a></acronym>
?

Both are valid, and there is no known difference in their effects, except
when style sheets assign properties to <acronym> in a manner that may
conflict with the default or styled presentation of <a>.
[snip]

Thanks for the detailed reply. I think I now have enough facts to make an
informed decision.

Cheers,
Rowan
 
N

Neal

I haven't checked the situation lately, but e.g. Firefox uses a dotted
line under both abbr and acronym if (and only if) the element has a title
attribute.

And apparently that was the flaw in my experiment. Seems even title=""
won't get the rendering, but an actual value will.
 
F

Foofy (formerly known as Spaghetti)

This is (I think) my first posting to this group, so please accept my
apologies if the question is inappropriate. I'd like to know what the
'correct' or 'preferred' approach is (if any) for defining anchor tags

I found this article helpful:

ABBR and ACRONYM are for user agents not for end users
<http://www.smackthemouse.com/20040108>
 
F

Foofy (formerly known as Spaghetti)

Fascinating reading, thanks very much. Now I'm much better informed, and
much less sure of what to do!

I would just use the method he uses, it's the same method used in books
and magazines and newspapers etc. Besides, it looks better when the page
is printed, and many users don't understand that they can hover the mouse
over it to see what it is. What about browsers where users simply can't do
that anyway, like PDA browsers and the like. It's a very simple rule: just
define rare acronyms (or ones the user is not expected to know, so for
beginners) in parenthesis alongside the acronym.
 

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,014
Latest member
BiancaFix3

Latest Threads

Top