htmlanchoralt

using alt for an anchor link


Reading google prompt for using alt in internal links (https://support.google.com/webmasters/answer/47334) I looked for answers. I found a bit old thread (Is it correct to use alt tag for an anchor link?) in stackoverflow with reasonable answers that using alt for an anchor link is incorrect. Can someone help me understand better?


Solution

  • You should use the title attribute for anchor tags if you wish to apply descriptive information similarly as you would for an alt attribute. The title attribute is valid on anchor tags and is serves no other purpose than providing information about the linked page.

    W3C recommends that the value of the title attribute should match the value of the title of the linked document but it's not mandatory.

    http://www.w3.org/MarkUp/1995-archive/Elements/A.html


    Alternatively, and likely to be more beneficial, you can use the ARIA accessibility attribute aria-label (not to be confused with aria-labeledby). aria-label serves the same function as the alt attribute does for images but for non-image elements and includes some measure of optimization since you're optimizing for screen readers.

    http://www.w3.org/WAI/GL/wiki/Using_aria-label_to_provide_labels_for_objects


    If you want to describe an anchor tag though, it's usually appropriate to use the rel or rev tag but you're limited to specific values, they should not be used for human readable descriptions.

    Rel serves to describe the relationship of the linked page to the current page. (e.g. if the linked page is next in a logical series, it would be rel=next)

    The rev attribute is essentially the reverse relationship of the rel attribute. Rev describes the relationship of the current page to the linked page.

    You can find a list of valid values here: http://microformats.org/wiki/existing-rel-values