I'm just asking about plain hyperlinks (not images as mentioned in Should html links with images have both title and alt attributes?)

I'm considering adding title for hyperlinks.

Should I add alt also? What will the the justification because I am always asked in the Pull Request Code Review.

  • 2
    The title attribute is mostly useless. It doesn't provide the accessibility benefits it is claimed. Screenreaders read out the link target content, you have to enable them to read 'Title' attributes, which people don't do because it just duplicates information read out. And keyboard users don't see them at all because they only show on hover. So the only people title benefits are fully sighted people who hover their mouse cursor over things. And if you're having to rely on those items to understand where links go then the issue is more in the wording of the link itself than the title.
    – JonW
    Commented May 9, 2016 at 13:01

2 Answers 2


No, alts tags are invalid attributes on <a> tags (i.e. hyperlinks).

W3 <a> tag specification :

  • Global attributes
  • href
  • target
  • download
  • rel
  • hreflang
  • type

and under "W3 Global Attributes" you get:

  • accesskey
  • class
  • contenteditable
  • dir
  • hidden
  • id
  • lang
  • spellcheck
  • style
  • tabindex
  • title
  • translate

As you can see alt tags are not in the list and thus invalid on hyperlinks. Invalid HTML is left up to the interpretation of the browser, so they may handle it well and improve accessibility or it could break the link and make it worse, thus should not be counted on. I also doubt screen readers are programmed to look for and read alt tags on elements that are not supposed to include it.



The a element can’t have an alt attribute.

alt is for providing alternative text for an image that can’t be loaded/perceived, so it wouldn’t make sense to use it for a hyperlink.

Attributes for a that can be relevant for accessibility

(Leaving technical things like using the correct dir, or adjusting tabindex if needed, aside.)


For title, the general rules for the title attribute apply: You can use it for advisory information, but don’t rely on it.

The spec gives an example how it can be used for links:

On a link, this could be the title or a description of the target resource

For example, you could have a link with the anchor "my website" and a title that gives the website’s title:

… <a href="http://example.com/" title="John’s blog | Example">my website</a> …

It can be useful to get this additional information (e.g., it might save the visitor a click, for example because they already know this site by its title), but it’s not a problem if it’s not there (or if the visitor doesn’t notice that it’s there or if the visitor can’t access it).


The hreflang attribute should be used if the target is in a different language than the document you are linking from.

… <a href="http://de.example.com/foo" hreflang="de">German translation</a> …

A user agent could announce/warn, offer to translate, etc.


If the link anchor text is in a different language than the rest of the document, you should use the lang attribute. If the target is also in this (or another) language, use hreflang in addition.

… German translation: <a href="http://example.com/de/hallo-welt" lang="de" hreflang="de">Hallo Welt</a> …

A user agent (e.g., a screen reader) could use the corresponding language module for reading it.


The type attribute should be used if the target is not a HTML document, e.g., for PDFs, MP3s, etc.

… <a href="http://example.com/foo.ogg" type="audio/ogg">Download OGG</a> …

A user agent could warn, or open it in a different context, etc.


The rel attribute is used to specify link types. Most link types don’t play a special role for accessibility, but there might be some (depending on your link purpose).

For example, it’s conceivable that the external link type (example) could be relevant (a user agent might decide to open these links in a different context), or the help link type (a user might offer a quick way to open these links), etc.

… <a href="http://example.com/help" rel="help">Help</a> …


The accesskey attribute can be used to associate a keyboard shortcut for visiting the link. But this should only be done in very specific cases (e.g., for a page’s primary link of a link aggregator site).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.