img alt Attribute - HTML CSS HTML Tag

HTML CSS examples for HTML Tag:img

Description

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!

Attribute Values

Value Description
text Specifies an alternate text for an image.

An image with an alternate text specified:

Demo Code

ResultView the demo in separate window

<!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>

Related Tutorials