Mobile app version of vmapp.org
Login or Join
Jamie184

: Can I include title for an HTML5 a element? 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,

@Jamie184

Posted in: #Html5 #Hyperlink #Tags #W3cValidation

Can I add title attribute for "a" element in HTML5? The spec does not mention title attribute for "a" element here www.w3.org/TR/html-markup/a.html, so for example, would it be valid to use

<a title="mylink" href="...

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Jamie184

2 Comments

Sorted by latest first Latest Oldest Best

 

@Kristi941

Title is common to all elements: www.w3.org/TR/html-markup/global-attributes.html#global-attributes
However, it is worth paying notice of the warning on this page: 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).

10% popularity Vote Up Vote Down


 

@Pope3001725

The 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 a tag.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme