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.
Loading...
Related Quiz
- To apply alternate row coloring in a table with CSS, you can use the ______ pseudo-class selector.
- A ______ tag is used to define a header cell in a table.
- Which attribute of the form element specifies where to send the form-data when the form is submitted?
- What happens if the DOCTYPE declaration is omitted from an HTML document?
- To send the form-data as an HTTP post transaction, the method attribute should be set to ______.