Can I add title attribute for "a" element in HTML5? The spec does not mention title attribute for "a" element here http://www.w3.org/TR/html-markup/a.html, so for example, would it be valid to use
<a title="mylink" href="...
title attribute is available to all HTML tags:
HTML defines a few attributes that are common to all HTML elements. These attributes can be used on all elements, though the attributes may have no effect on some elements.
So you can safely put it on any element you want. But it is up to the browser to determine if it will do anything with that information. Having said that, you can safely count on all major browsers showing a tooltip of some kind for the
title attribute on a
Title is common to all elements: http://www.w3.org/TR/html-markup/global-attributes.html#global-attributes
However, it is worth paying notice of the warning on this page: http://www.w3.org/html/wg/drafts/html/master/dom.html#the-title-attribute
Relying on the title attribute for the visual display of text content is currently discouraged as many user agents do not expose the attribute in an accessible manner as required by this specification (e.g. requiring a pointing device such as a mouse to cause a tooltip to appear, which excludes keyboard-only users and touch-only users, such as anyone with a modern phone or tablet).