A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/html/html-alt-attribute/ below:

HTML alt attribute - GeeksforGeeks

HTML alt attribute

Last Updated : 12 Jul, 2025

The alt attribute in HTML provides alternative text for images, aiding accessibility and providing context for screen readers.

Syntax:

<img src=" " alt=" " >
HTML
<html>
  <body>
    <h1>GeeksforGeeks Logo</h1>
    <img src="https://media.geeksforgeeks.org/wp-content/uploads/20190506164011/logo3.png"
         alt="GeeksforGeeks Logo">
  </body>
</html>

Supported tags:

Name

Description

area

<area>'s alt provides alternative text for image map areas.

image

<img> alt offers alternative text for image accessibility.

input

specify the alternative text for an image when the image attribute is not displayed.

<applet>

used to specify the alternate text for an applet element.

Attribute Values:

value

Description

text

is used to specify the alternative text for the supported element if the image is not displaying.

More Example of HTML alt attribute

Image Input with alt Attribute HTML
<html>
<body>
	<form action="/submit" method="post">
		<label for="username">Username:</label>
		<input type="text" id="username" name="username"><br><br>
		<input type="image" src="https://media.geeksforgeeks.org/wp-content/uploads/gfg-40.png" alt="Submit"
               width="48" height="48">
	</form>
</body>
</html>

In this Example:

Image Map with alt Attributes HTML
<html>
<body>
	<img src="https://media.geeksforgeeks.org/wp-content/uploads/20190227165729/area11.png" 
         alt="Geometric Shapes"
		width="300" height="119" usemap="#shapemap">
	<map name="shapemap">
		<area shape="poly" coords="59,31,28,83,91,83" href="#triangle" alt="Triangle">
		<area shape="circle" coords="155,56,26" href="#circle" alt="Circle">
		<area shape="rect" coords="224,30,276,82" href="#square" alt="Square">
	</map>
</body>
</html>

In this example:

Best Practices for HTML alt Attribute

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4