HTML img alt attribute
Browser Support
All major browsers support the alt attribute.
Definition and Usage
alt attribute is a required attribute that specifies alternate text when the image can not be displayed.
Suppose for some reason (such as speed is too slow, src attribute errors, disable browser images, the user is using a screen reader) the user can not view the image, alt attribute provides alternative information for the image.
Note: When users move the mouse to the img element, Internet Explorer (9 previous versions) the value of the alt attribute is displayed as a tool tip.According to the HTML specification, this behavior is not correct.
Tip: If you need to create an image tooltip, use the title attribute!
Differences between HTML 4.01 and HTML5
no.
grammar
<img alt="text">
Property Value
值 | 描述 |
---|---|
text | 规定图像的替代文本。 alt 文本的使用原则:
|
HTML <img> tag