Jump to content

Title tag


kurt.santo

Recommended Posts

<img src="image.jpg" alt="alt is the title tag for images" />

<a href="index.htm" title="title is the title tag for hyperlinks">Link</a>

If you have an image within a hyperlink, alt="" will not display, but you still must have the alt tag. It's required (try to validate it without it). At least in XHTML it's like that

Link to comment
Share on other sites

Alt is not the title attribute for images. Only Internet Explorer does that.Alt is to display alternate text if the image is not available.The title attribute can be applied to nearly anything rendered in the browser:<img title="title text" src="something" alt="something" /><a title="title text" href="something">Text</a><div title="title text">Something</div><span title="title text">Something</span>

Link to comment
Share on other sites

What?I have tried title in img, I didn't get that valid in the W3 validatorAnd it didn't show up eitherAnd alt doesn't just show if the image doesn't load. It comes up after some seconds if you have your mouse over the image too

Link to comment
Share on other sites

What?I have tried title in img, I didn't get that valid in the W3 validatorAnd it didn't show up eitherAnd alt doesn't just show if the image doesn't load. It comes up after some seconds if you have your mouse over the image too
That only happens in Internet Explorer and not in any other browser.
Link to comment
Share on other sites

Opera does not show alt text as a tooltip popup like IE does, it doesn't show it at all if the image exists. Alt text is alternate text in case the image does not exist or the user agent does not support images. Just because Microsoft decided to do something else with it doesn't mean that's what it's for. Look at the list of standard attributes, they apply to nearly every tag except the few tags listed. Title is a standard attribute.http://w3schools.com/tags/ref_standardattributes.asp

Core AttributesNot valid in base, head, html, meta, param, script, style, and title elements....title tooltip_text A text to display in a tool tip
http://www.w3.org/TR/html401/struct/global.html#adef-title
Values of the title attribute may be rendered by user agents in a variety of ways. For instance, visual browsers frequently display the title as a "tool tip" (a short message that appears when the pointing device pauses over an object). Audio user agents may speak the title information in a similar context.
alt = text [CS]For user agents that cannot display images, forms, or applets, this attribute specifies alternate text. The language of the alternate text is specified by the lang attribute.
The spec doesn't say anything about rendering alt text when the image is present, that's something Microsoft (and no one else) did on their own. That behavior does not exist in Opera, Firefox, Safari, or Netscape. If you don't believe me, download them and try it yourself, I did. But don't make statements like this:
That only happens in Internet Explorer and not in any other browser.NopeHow come it shows up in Opera then?
if you don't know.As for the validator, go ahead and run these through it:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html>  <head>	<title>Alt Test</title>  </head>  <body>	<div>	  <img src="true.jpg" alt="this is alt text" title="this is title text">	</div>  </body></html>

<!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" xml:lang="en" lang="en">  <head>	<title>Alt Test</title>  </head>  <body>	<div>	  <img src="true.jpg" alt="this is alt text" title="this is title text" />	</div>  </body></html>

If you want to see a site using alt and title attributes properly on images, go look at xkcd.com. When an image has both an alt and a title, IE works like other browsers and shows the title.

Link to comment
Share on other sites

Guest FirefoxRocks

The title attribute on the <img /> element overrides the alt attribute in Internet Explorer.The alt attribute is used when the image doesn't exist (broken image URL), the image doesn't load (disabled images) or by screen-reading software if the user is visually-impaired.In Internet Explorer ONLY, the alt attribute also serves as tooltip text, although the title attribute is for this purpose. Tooltip text will not appear in other browsers if you do not specify the title attribute.The alt attribute is mandatory for HTML 4.01 and XHTML 1.0+, the title attribute is a generic attribute for applying tooltip text to (almost) any element.The alt and title attributes are valid on the <img /> element, the title attribute is also valid on the <a> element.Hope this clears some things up.

Link to comment
Share on other sites

Do whatever makes sense in the context. If the text of the title attribute describes the page that gets linked to or the link itself, put it on the <a> tag. If the title text describes the image, put it on the <img> tag.
Is the same meaning as just larger version of picture... In this context: Lets say the picure shows one thing and link points to webpage with different content. Then you could have title in both of them?Kurt
Link to comment
Share on other sites

Is the same meaning as just larger version of picture... In this context: Lets say the picure shows one thing and link points to webpage with different content. Then you could have title in both of them?
You can only have 1 title per link, image, etc.With the picture that takes you to different content...Take this exampleA picture of a horse, and within the picture theres text of "She's a pro thanks to these lessons".Then the link says "Become like her"And the title can be something like.."Click here to signup for lessons"That's just an example.
Link to comment
Share on other sites

Then you could have title in both of them?
You could put a title on both the link and the image, but I'm not sure which title the browser would show if you hover over the linked image. Putting a title on both of them would be more beneficial to a search engine then the browser.
Link to comment
Share on other sites

You could put a title on both the link and the image, but I'm not sure which title the browser would show if you hover over the linked image. Putting a title on both of them would be more beneficial to a search engine then the browser.
Tested to have one in link and one in image. The browser display the title tag from the image (FF, IE, Opera, Netscape - Safari does not disply any title). Why is it benefical for the seach engines to have it in both? Does this make indexing easier for them?Kurt
Link to comment
Share on other sites

It's actually not going to help your site much unless the link is an internal link. If it's an external link to another site it will help the other site more then yours. If it's an internal link to another page on your site then it's just a place to add a few more keywords about that page.

Link to comment
Share on other sites

It's actually not going to help your site much unless the link is an internal link. If it's an external link to another site it will help the other site more then yours. If it's an internal link to another page on your site then it's just a place to add a few more keywords about that page.
Thanks for the advice...Kurt
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...