<a href=''> and TITLE and ALT

After reading the HTML4 specs, I was surprised to see there is no ALT or TITLE attributes…

Is there a way that I can offer those for a hyperlink?

Sincerely,

Debbie

HTML offers global attributes which anchors are allowed to use. IIRC alt is not allowed since no alternative text can be given. However, title attribute is allowed - it is a global attribute. I know title=“” works because I’ve done it in the past and it is a global attribute which anchors support.

As Ryan says, you can use “title” on most elements, including links. “alt” is to provide alternative text for an image. You might find these helpful:

I find the title attribute limiting and far more flexible to have hidden spans that are revealed when hovered. Also title does not allow linefeeds but revealed spans accept
\r\ along with borders. I also believe that the verbose span content helps with your SEO Brownie Points.

Beware this is a mouse only feature and unfortunately does not work on tablets and smartphone. I am not sure about the SEO benefits but no doubt another poster can enlighten me with their opinions and thoughts:)

1 Like

I do not believe there is much, if any benefit for those in terms of SEO. I agree with this article.

http://ezinearticles.com/?Do-Alt-and-Title-Attributes-Help-With-SEO?&id=432783

The hidden spans I had in mind were neither alt nor title attributes but precede the</a> tag.

Is the initial span {display: none} ignored by search engines and also are they considered “Black Hat” techniques?

[ot]This thread seems to be wandering off-topic; SEO was not part of the original question. But as the question’s been asked:

Also: http://googlewebmastercentral.blogspot.co.uk/2007/12/using-alt-attributes-smartly.html

I can’t find any reference to Google using title attributes (as opposed to the title meta tag).
[/ot]

Title attributes on the anchor tag are valid and occasionally useful and [URL=“http://www.nngroup.com/articles/using-link-titles-to-help-users-predict-where-they-are-going/”]have been for years.

More info:
http://www.w3.org/TR/WCAG20-TECHS/H33.html

However the bottom line is that if the information is important then it should be in real text and not the title text. Only informative text should be provided via the title attribute but the link itself should be self evident as to its purpose which why the usal “click here” is frowned upon and is says nothing about where you are going.

Don’t use the title attribute just because you didn’t have room in the html for what you really wanted to say. A better method would be hiding the text offscreen in a span and showing that as a tooltip as John suggests above.

When a person is viewing a Private Message, in the header, I have a hyperlink with varying text, e.g. Incoming Folder, Sent Folder, Trash Folder.

(The idea being, that you can go back to the parent folder when you are done reading the message.)

Off Topic:

Yeah, it would have been nice if I would have had the folders off to the left like every other messaging system for the past 20 years, but I just didn’t have time to build that in!! :stuck_out_tongue:

Anyways…

So I wanted to see if adding additional cluing text (e.g. “Go to Incoming Folder”, “Go to Sent Folder”, “Go to Trash Folder”) would be okay.

I see your point, Paul, and agree, but don’t know if I feel guilty with my links or adding an additional TITLE hint.

If a person was a purist, they would say, “Well, Debbie, your links should say ‘Go to Incoming Folder’” but I think that extra text is unnecessary for most users, and yet to help those who need a little more of a clue, I thought adding a TITLE thingy might help?!

(BTW, after I posted my OP, it dawned on me that using ALT for a hyperlink would be senseless!) :blush:

Hope all of this makes sense…

Sincerely,

Debbie

I do believe Google punishes websites for doing this - you will notice that this method is almost non-existent for websites trying to cram SEO in.

What Google objects to is “cloaking” - trying to show different content to human visitors and search bots. I doubt they’d have any problem with this technique - used in moderation, of course, and only where it’s of benefit to the humans. :slight_smile:

Interesting point and I will investigate tomorrow and also Paul’s suggestion recommended by W3.Org for “Using CSS to hide a portion of the link text”.

Google Webmaster Tools has not mentioned or reduced my SEO Brownie Points for using this technique?

Off Topic:

Off to bed for an early night because it is Launch Day tomorrow for Sitepoint’s New Forum!!!

Of course - that’s why I mentioned websites trying to cram in SEO - meaning what you are saying, that they only punish for those cramming in SEO :).

Yay!!

A link with a title attribute

<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">

<head>
  <title>A link with a title attribute - see the tooltip when you hover over the link</title>
</head>

<body>
<p><a href="http://www.example.com" title="Programming Code Examples">anchor text</a>.</p> 
</body>
</html>
1 Like