Thursday, 21 June 2012

How to add Alternative text for an image

Alternative text for an image can be added easily by using the ALT Attribute. You use it like this:

<IMG SRC="york_images/york_minster.jpg" ALT="York Minster">

ALT means "alternative text". If the image does not display then users will see the text between the double quotes of ALT. Try it out. Change your HTML code to this:

<IMG SRC="york_images/york_min.jpg" ALT="York Minster">

Here, we've changed the name of the image. Now save your work and refresh your page in the browser. You should see this (Internet Explorer):

Browser showing the effects of the ALT attribute

Internet Explorer has added the ALT text after the red X.

You should always add some ALT text to your IMG tags as it is helpful to blind and partially sighted users: the ALT text will be read out. ALT text is also useful for search engines, especially Google's image search.

No comments:

Post a Comment