contact@codebetter.in 8823075444
9993928766
  • Tutorials Home
  • Contact

What is the purpose of the alt attribute in <img> tag?

The alt attribute specifies an alternate text for an area, if the image cannot be displayed. The alt attribute provides alternative information for an image if a user for some reason cannot view it (because of slow connection, an error in the src attribute, or if the user uses a screen reader).

Example: <img src="codebetter.jpg" alt="CodeBetter" width="500" height="600">
Output: CodeBetter