What is the primary purpose of the alt attribute in an img tag?

  • To define the image source URL. 
  • To enhance the image's resolution. 
  • To offer a text description of the image for screen readers and when the image cannot be displayed. 
  • To provide a tooltip when the mouse hovers over the image. 
The alt attribute, often called an "alt tag" (though technically it's an attribute, not a tag), is used to describe the content of an image. This serves two main purposes: accessibility and usability. For visually impaired users utilizing screen readers, the alt text provides a description of the image's content. Additionally, if an image fails to load for any reason, the alt text will be displayed in its place, informing users of the intended content. 
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *