HTML img alt Attribute

Definition and Usage

The alt attribute should be a short description of the image
This attribute is used when the user for some reason cannot see the image. This could be because of a slow connection, an error in the image URL, or the user could be using a text-only or non-visual browsers.


<img alt="text" />

Syntax Example

<img alt="Example picture" />

Attribute Values

Value Description
type A short description of the image.Guidelines for the alt text:
  • If the image contains important information - use the attribute to describe the image.
  • If the image is a link (inside an "<a>" element) - use the attribute to explain the link (like url and target frame)
  • If the image is not informative (only for decoration) - Use an empty alt attribute (like alt="")
Note: Not using the alt attribute will cause problems for text-only browsers or non-visual browsers.
HTML img alt Attribute Reviewed by 1000sourcecodes on 04:30 Rating: 5
Powered by Blogger.