<abbr> in Internet Explorer using XHTML

Posted on Tuesday April 11th, 2006


The <abbr> and <acronym> tags are useful for defining terms and assisting users. When discussing the styling of both tags, I mentioned that Internet Explorer does not support <abbr>. This is partially false. By explicitly applying a namespace to your XHTML, you can help Internet Explorer detect, properly utilitize, and style the abbr tag as easily as <acronym>.

Apply the Namespace

A second namespace can be applied to your document. This is done by adding the namespace to the declaration in your html opening tag. This example assumes a US English document:

<html xmlns:html="http://www.w3.org/1999/xhtml" xml:lang="en">

I used html as my namespace, but you can use anything really. Now you can use the tag through this namespace so most browsers will behave normally, and Internet Explorer now recognizes it.

<html:abbr title="Three Letter Acronym">
TLA
</html:abbr>

Style the Tags

You can now apply any styling you wish. Make sure when you write your selector that you include the namespace with the escaped colon.

html\:abbr
    {
    cursor: help;
    }

Validation and other concerns

This is a valid use of XHTML, and an excellent example of the extensibility that differentiates XHTML and other XML-based languages from their predecessors. However, if you attempt to use the W3 Markup Validation Service, it cannot process any namespace except the one declared in your DTD, and it will falsely report validation errors. Support will be added in the future, hopefully as the demand for validating markup increases ¤