Friday, October 1, 2010

Alt text overriding title text

Problem: If you have an image with alt text nested inside a link that has a title element,
the title element will be overridden. This is largely due to Internet Explorer wrongly displaying
the content of the alt attribute as a tooltip.


Solution: The only way around this problem is to duplicate the title attribute and place a
copy of it within the img element. This is superfluous markup, but it fixes the issue in
Internet Explorer and does not adversely affect other web browsers.
<a href="sunset.html" title="Click to view a larger image"><img
å title="Sunset in Reykjav&iacute;k" src="sunset.jpg" alt="Sunset in
å Reykjav&iacute;k" width="400" height="300" /></a>

No comments:

Post a Comment