Jump to content

Anchor <a> Tag Attributes


Recommended Posts

Which tag attribute is the best to use in an anchor tag ... alt or title?


For example,

<a href="htt*://www.mywebsite.com" alt="Go to my new web site!">Go Now</a>




<a href="htt*://www.mywebsite.com" title="Go to my new web site!">Go Now</a>


Is it best to use both alt and title? The only problem I can see with that approach is the moderate increase in bandwidth that would result from having extra characters in your anchor tag. It may not be much if you have a few links, but for a page of bookmarks, for example, you could have many, many links, and that would draw eat your bandwidth considerably, especially on a popular page.

Link to comment
Share on other sites

Good question. I just recently discovered that the 'alt' tag doesn't work in Netscape 7.1 so I had to use the title tag instead (in addition to). That confuses me.


Best? I honestly don't know, especially as i was always under the impression that the 'alt' and 'title' tags were 2 totally different things. :lol:

Link to comment
Share on other sites

alt for images, title for text links.


alt = alternate way to display image

title = more information on the link before clicking it


The alt tag *does* work in Netscape; however it doesn't produce a hover effect (it doesn't in firefox either, but I have an extension installed to fix this.) the purpose of the alt tag isn't actually for that nice hover; but for people that can't get or see the images, to replace them or for screen-readers to read them.. the hover is just nice for those of us without accessibility issues. =)

Edited by TCH-Lisa
Link to comment
Share on other sites

  • 2 weeks later...

BTW: an image tag can have both the alt and the title attribute. The alt attribute shows up in case the image doesn't download and the title tag is what is *supposed* to show up when you hover over the image. So if you have a picture of your dog, it can be as follows:


<img src="images/mydog.jpg" title="Kpax chilling on the lawn" alt="image of my pet dog Kpax" height="150" width="170" border="0">


Some browsers do this better than others. :P Sorry if it's off topic.




Link to comment
Share on other sites

  • 4 weeks later...

Use "alt" (as I understand it, this is now actually required) for images. This is to allow nongraphical browsers, spiders and other visitors that can't see images to see a text placeholder. It will generally remain invisible, however, as long as your browser is set to display images. It is not designed for text links.


"Title," on the other hand, is designed to provide purely elective additional information on either images or text. This will generally appear as a hover effect (depending on your browser) whether images can be seen or not; it is not a substitute for images, and it will therefore not satisfy the HTML alt requirement.


As !!blue says, images can be assigned both alt and title tags—but, again, the former is required and the latter is not. Using alt for text, however, is not logical in that the text will appear no matter the visitor's settings, so there is nothing to substitute the tag for and no one will ever see it.

Link to comment
Share on other sites

Jim is, of course, quite right:


Alt is an attribute of an <img ...> tag, and title most commonly an attribute of <a href ...>.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...