What is the purpose of the alt attribute in an image tag?
It determines the size and dimensions of the image.
It helps with search engine optimization by providing keyword-rich text.
It serves as a tooltip when the user hovers over the image.
It specifies the alternative text that is displayed if the image cannot be loaded.
The alt attribute in an image tag is used to specify the alternative text that should be displayed if the image cannot be loaded. This is important for accessibility as it allows visually impaired users or users with slow internet connections to understand the content of the image. The alt text should provide a clear and concise description of the image so that users can still comprehend the information conveyed by the image, even if they cannot see it.