The title attribute is best used to add optional advisory information to an element.
For example, suppose that you were writing an article about overcoming adversity and you made a passing reference to Lance Armstrong. Most of your readers will know who Lance Armstrong is, so you don’t want to spend time explaining, but the few who don’t might benefit from a brief description in a title attribute. The link above has this: “Professional cyclist who overcame testicular cancer to win the Tour de France a record seven consecutive times”.
Some users won’t be able to access the title attribute: most screen reader users won’t hear it, and keyboard users won’t see it. For mouse users who hover questioningly over the link, however, enlightenment will appear in the form of a tool tip, so the title attribute does serve a purpose.
The content of the title attribute is all important. If your title attribute contains vital information, then all of your users who can’t or don’t access it will be in trouble. If it contains trivial information, then your users who do access it will have wasted their time. Striking a balance can be difficult.
Unfortunately, misuse of the title attribute is everywhere. WordPress websites are as guilty of this as any.
WordPress’s default behaviour is to add title attributes to pretty much every link that it can, whether it has advisory information about it to offer or not. Here’s a partial survey of the results:
- Links in Page lists are given title attributes that merely duplicate the link text, adding no new information at all.
- Links to archives get the same treatment, with link text duplicated in title attributes.
- Links in category lists get the slightly better “View all Posts filed under [category name]“, which does at least explain where clicking the link text “Category Name” will take you, in case there’s any doubt.
- The “Edit” links that appear on Posts get “Edit Post” as the title attribute, which might be useful if you’re wondering what it is that a link will allow you to edit, but disappointingly the “Edit” link on Pages gets “Edit Post” too, somewhat nullifying this.
- If you use the built-in “Recent Posts” widget, then you’ll again see link text pointlessly duplicated in title attributes.
While some of these uses of the title attribute can be defended, others can’t. Overall, WordPress websites would be better with no title attributes than with all of those added by default. For that reason, I’ve created a new plugin: Remove Title Attributes, which can be downloaded from the WordPress Plugins Directory.