HTML CSS examples for HTML Tag:img
The required alt attribute sets an alternate text for an image, if the image cannot be displayed.
To create a tooltip for an image, use the title attribute!
Value | Description |
---|---|
text | Specifies an alternate text for an image. |
An image with an alternate text specified:
<!DOCTYPE html> <html> <body> <img src="https://www.java2s.com/style/demo/Opera.png" alt="Smiley face" width="42" height="42"> </body><!--from w w w. j av a2 s.co m--> </html>