HTML alt attribute (original) (raw)

Last Updated : 6 May, 2026

The HTML alt attribute provides alternative text for an image, describing its content when the image cannot be displayed or for accessibility purposes.

**Syntax:

description

HTML `

GeeksforGeeks Logo

GeeksforGeeks Logo

`

The alt attribute in the tag provides descriptive text ("GeeksforGeeks Logo") that displays if the image fails to load, enhancing accessibility.

Attribute Values

Example of HTML alt attribute

Here are some examples of HTML alt attribute:

1. Image Input with alt Attribute

HTML `

Username:

`

2. Image Map with alt Attributes

HTML `

Geometric Shapes

`

Best Practices for HTML alt Attribute