Is it correct to use alt tag for an anchor link?

Is it correct to use alt tag for an anchor link, something like

<a target="_blank" rel="nofollow" href="#" class="test" alt="Something" src="sfasfs" ></a>

using alt for an anchor link

Reading google prompt for using alt in internal links ( I looked for answers. I found a bit old thread (Is it correct to use alt tag for an anchor li

jquery use image alt text as link anchor text

i’m trying to use an image’s alt text and use it as the text for its corresponding anchor tag. this would be used at some point in a slide show. this is what i have so far, but it’s inserting the all

Correct implementation of anchor tag

I am wondering if there is a correct way to implement the anchor tag as I have seen the following examples <p id=somename>text</p>, <h1 id=someheader>header</h1>, etc This

Correct use of anchor in rails to link_to different page

I am trying to use correctly :anchor in my Rails app but I can’t get it work correctly. my example: <% = link_to(‘Artist Page’, artists_path(artist, :anchor => ‘ranking’)) %> and the link I

without protocol anchor tag href link

In anchor tag href link like <a href=//> Is it right way to declare, without protocol (http: or https:). Because, http to https when we changes the link depends upon

Anchor tag display full link issue

I found some really awesome link detection regex that works unbelievably great. It takes only the main part of a link and displays it as the body of the anchor tag and the whole link as the href. In e

Click anchor tag link on enter press

I have an anchor tag like <a class=btn btn-danger id=clicking data-bind=click: $root.enterLocation href=#>Continue</a> It’s inside a pop-up. I need to click on this link on pressi

CakePHP – Creating a link URL without the anchor tag

I am using CakePHP and want to create a URL to a controller/view without including the anchor tag. In other words if I use $this->Html->link(‘foo’,array(‘controller’=>’bar’,’action’=>’disp

Use server tag in an anchor tag

I would like to use a property ID value in the anchor tag as below: <a id=aExample href=/test/example.aspx?id=<%# Id %> runat=server>Example</a> But when the page is rendered

Jquery: Replace image source getting link from anchor tag

I need a help and I am stuck how to replace a image source by getting the url link from its anchor tag. And I need to repeat this for a n number of div. What I have is n number of div, and a anchor ta


For anchors, you should use title instead. alt is not valid atribute of a. See

Such things are best answered by looking at the official specification.

  1. go to the specification:
  2. search for “a element”:
  3. check “Content attributes”:

    Global attributes

  4. check “Global attributes” for alt:

As you will see, the
alt attribute is not allowed on the
a element.

Also you’d notice that the src attribute isn’t allowed either.

By validating your HTML errors like these are reported to you.

No, an alt attribute (it would be an attribute, not a tag) is not allowed for an a element in any HTML specification or draft. And it does not seem to be recognized by any browser either as having any significance.

It’s a bit mystery why people try to use it, then, but the probable explanation is that they are doing so in analog with alt attribute for img elements, expecting to see a “tooltip” on mouseover. There are two things wrong with this. First, each element has attributes of its own, defined in the specs for each element. Second, the “tooltip” rendering of alt attributes in some ancient browsers is/was a quirk or even a bug, rather than something to be expected; the alt attribute is supposed to be presented to the user if and only if the image itself is not presented, for whatever reason.

To create a “tooltip”, use the title attribute instead or, much better, Google for “CSS tooltips” and use CSS-based tooltips of your preference (they can be characterized as hidden “layers” that become visible on mouseover).

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.

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 your optimizing for screen readers.

If you want to describe an anchor tag though, it’s usually appropriate to use the rel or rev tag but your 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:

“title” is widely implemented in browsers. Try:

<a target="_blank" rel="nofollow" href="#" title="hello">asf</a>

I used title and it worked!

The title attribute gives the title of the link. With one exception, it is purely advisory. The value is text. The exception is for style sheet links, where the title attribute defines alternative style sheet sets.

<a class="navbar-brand" target="_blank" rel="nofollow" href="" title="sito dell'Istituto Ancel Keys">A.K.</a>