Search code examples
twitter-bootstrapw3c

rel="tooltip", is it bad practice?


In the bootstrap documentation for tooltips, it uses <a href="#" rel="tooltip" title="first tooltip">hover over me</a>. Tooltips are just cosmetic though. Not css style but just a bit of JS to change how a title attribute is presented.

The "rel" attribute is meant to be used to tell a bot (such as google) about the nature of a link. The options are alternate, author, bookmark, help, license, next, nofollow, noreferrer, prefetch, prev, search, and tag.

Is it not bad practice to use rel = "tooltip" since tooltip is cosmetic, says nothing about the nature of the link, and isn't otherwise bot or browser interpret-able?


Solution

  • By using rel="tooltip" your document won't validate by the W3C web standards.

    You will get this error from the W3C validator:

    Bad value tooltip for attribute rel on element a: Not an absolute IRI. The string tooltip is not a registered keyword or absolute URL.

    It would be better, identifying a tooltip link with a class like:
    <a href="#" class="tooltip" title="first tooltip">hover over me</a>

    • However, the rel attribute is not used by the browser in any way, as you already mentioned, but it may influence your ranking in search engines. Google suggests to validate your documents and to "write good, clean HTML".
    • The rel attribute may also be interesting for accessibility tools like screen readers.