I figure that as this is Page 3 of my website, I ought to have a picture of some naked chicks. Enjoy!
...Mark Up An Abbreviation
There are two HTML elements for dealing with abbreviations: and
.
So what's the difference? Although it is generally agreed that any shortening of a word or phrase is an abbreviation, and that some abbreviations are acronyms, there are two schools of thought on deciding exactly which abbreviations are acronyms:
- You pronounce acronyms as words instead of spelling them out. For example, the following are acronyms: radar, UNICEF; the following are not acronyms: UK, FTP. There are of course borderline words which some people spell out and others pronounce as words, such as URL.
- Acronyms are formed by taking the initial letter or letters from a group of words. For example, the following are acronyms: radar, UNICEF, UK, FTP; and the following are not acronyms: Dr, abbr.
So there is a lot of confusion about which abbreviations are acronyms. For this reason, it is safest to always use . Indeed,
is being removed from future versions of (X)HTML.
Problem
Internet Explorer doesn't support . It can't style it with CSS, it doesn't display the title in a tooltip when the mouse hovers over them and it doesn't even add the relevent nodes to the DOM tree. Yet it supports
just fine.
This may seem strange — after all, all that needs to be done is for Internet Explorer to handle them both (more or less) the same! However, due to a historical dispute with Netscape, Microsoft have deliberately ommitted support for .
to the rescue!
Despite completely ignoring , Internet Explorer can be coaxed into the appearance of treating it properly using a little hackery involving
. For example:
UN
However this involves quite a bit of duplication, especially on an abbreviation-heavy page, so is hardly ideal.
JScript to the rescue!
Instead of manually adding all those tags, Marek Prokop recommends using a little JScript:
function styleAbbr() {
var oldBodyText, newBodyText, reg
if (isIE) {
oldBodyText = document.body.innerHTML;
reg = /]*)>([^<]*)<\/ABBR>/g;
newBodyText = oldBodyText.replace(reg,
'$2');
document.body.innerHTML = newBodyText;
}
}
window.onload = function(){
styleAbbr()
};
isIE = (document.all) ? true:false;
It should be pretty obvious how this works, but Marek explains it all.
Conditional comments to the rescue!
Now we have an almost perfect solution, but we can go a step better in my opinion. Currently, good browsers that support , such as Netscape, Mozilla and Opera, will have to download and execute the JScript above. Because of the
if (isIE)
condition, execution will be minimal, but it's still better to hide the script from them altogether.
To do this, we can use the misguided magic of conditional comments. Firstly create a file called "abbr.js" (or whatever) containing the code from the section above and then link to it like:
Most browsers will ignore that entire block as it is a comment. Internet Explorer 5+ will think it's special and will download and run the JScript.
This last technique is what I use on this web page.
References
- Marek Prokop: Styling in IE.
- Jukka Korpela: Explaining abbreviations, acronyms and symbols on Web pages.
- W3C HTML 4.01 Recommendation: ABBR, ACRONYM.
- Craig Saila: HTML is not an Acronym.
- Microsoft: About Conditional Comments.
...Do Navigation
A few of my thoughts on good ways to do navigation.
- Consistancy is good — and not just within your own site! Remember that people spend at least 99% of their time on other people's sites so are more familiar with the rest of the Internet than your site. So try to use navigation ideas from other popular sites so that people will quickly learn how yours works.
- Read Jacob Nielsen's article Is Navigation Useful?. Summary: don't go overboard on navigation — every page on your site doesn't need to link to every other page. Include a link to the front page, a search box and a link to the site map. Include a few links to related pages on the site — for example, on an order form include a link to your security and privacy policies.
- Don't hide the link to the site map away. Some sites seem to place it in the tiny print (along with copyright) at the bottom of the page. Put it near the top: by the search box for example.
- Another good idea is to make extensive use of the
element. For people using browsers that support it (Mozilla, Opera, Lynx, etc) it is a big help to navigation. For people using browsers that don't support it (IE, NN4, etc), it doesn't cause any harm. Read more about
elements in Sander Tekelenburg's article Navigating the WWW.
- Remember that navigation isn't just about letting people know where they can go, it's also about letting the user know where they are now and where they've been before. Bread-crumb trails give a good idea of how "deep" you are in the site as well as what topics lie "above" where they are now. Make sure that visited links are a different colour from regular links — this will let people know where they've been before.
- Don't rely on Javascript, Flash or other trickery for navigation. Navigation is a basic site function so you need to use reliable technologies.
- Rule #1 of Navigation: if you ever feel the need to explain how to use a particular navigational device, scrap it.