
Originally Posted by
mannequin-lady
I wanted to see what the title tag would do and I don't see any difference... The second forward facing large dress form photo (in other words it is underneath the original image and html as I had it) is the one where I entered the above code with the title.
Depending which browser you are using you will see either the title attribute text on mouse over (Opera, Firefox, Safari, IE 8) or the alt attribute text in IE5, 5.5 ,6 and 7. You will need to verify this informaiton since I no longer have any older machines running earlier browsers.
You will want to examine the W3C specifications, as well as read up on WEBAIM (Web Accessibility in Motion, home of Cynthia Says) who's information contains clear guidelines for these attributes.
In the meantime, here is some experimental code to run in all your browsers, just to see for yourself what is happening in each one.
HTML Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>ALT versus TITLE in IMG tags, with and without wrapping A tag</title>
<style type="text/css">
body {font-size: 100%;}
h2 {font: bold 80% Verdana,Geneva,sans-serif;}
#content li {font: normal 70% Arial,Helvetica,sans-serif;}
img {vertical-align: middle; display: inline;}
</style>
</head>
<body>
<h1><em>alt</em> and <em>title</em> attributes in IMG and A tags</h1>
<div id="content">
<h2>Stand alone image</h2>
<ol>
<li><img src="#" alt="ALT - image by itself with alt attribute" width="100" height="80"></li>
<li><img src="#" alt="" title="TITLE - image by itself with title attribute and null alt attribute" width="100" height="80"></li>
<li><img src="#" alt="ALT - image by itself with alt and title attributes" title="TITLE - image by itself with alt and title attributes" width="100" height="80"></li>
</ol>
<h2>Stand alone anchor</h2>
<ol>
<li><a href="#">Anchor with no title attribute</a><li>
<li><a href="#" title="TITLE - may be TITLE in HEAD of target page">Anchor with title attribute</a><li>
</ol>
<h2>Anchor wrapping an image</h2>
<ol>
<li><a href="#"><img src="#" alt="ALT - text only" width="100" height="80"></a> ALT - text only</li>
<li><a href="#"><img src="#" alt="" title="ALT is null, TITLE - text only" width="100" height="80"></a> ALT is null, TITLE - text only</li>
<li><a href="#" title="TITLE - on anchor ALT on IMG is null"><img src="#" alt="" width="100" height="80"></a> TITLE - on anchor ALT on IMG is null</li>
<li><a href="#" title="TITLE - on anchor ALT only on IMG tag"><img src="#" alt="ALT - text only" width="100" height="80"></a> TITLE - on anchor ALT only on IMG tag</li>
<li><a href="#" title="TITLE - on anchor ALT on IMG is null TITLE on IMG is text"><img src="#" alt="" title="TITLE - on IMG tag" width="100" height="80"></a> TITLE - on anchor ALT on IMG is null TITLE on IMG is text ("TITLE on IMG tag")</li>
<li><a href="#" title="TITLE - on anchor ALT on IMG is text TITLE on IMG is text"><img src="#" alt="ALT - on IMG tag" title="TITLE - on IMG tag" width="100" height="80"></a> TITLE - on anchor ALT on IMG is text ("ALT on IMG tag") TITLE on IMG is text ("TITLE on IMG tag")</li>
</ol>
</div>
</body>
</html>