English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

HTML tag大全

HTML: <img> longdesc attribute

The longdesc attribute specifies a hyperlink to the detailed description of the image.

 HTML <img> tag

Online examples

Several examples of how to use the longdesc attribute:

<!DOCTYPE html>
<html>
<head>
<title>HTML:<img> longdesc attribute - 基础教程网 oldtoolbag.com</title>
<body>
<!-- The description is on the same page as the image -->
<img src="sun.gif" alt="oldtoolbag.com" width="100" height="132" longdesc="#w3codebox_Explained">
<!-- The description is in an external page -->
<img src="sun.gif" alt="oldtoolbag.com" width="100" height="132" longdesc="w3codebox.txt">
<!-- The description is one of several within an external page -->
<img src="sun.gif" alt="oldtoolbag.com" width="100" height="132" longdesc="http://example.com/desc#item3">
<!-- The description is included in a data:URI -->
<img src="sun.gif" alt="oldtoolbag.com" width="100" height="132" longdesc="data:text/html;charset=utf-8;,%3C!DOCTYPE%20html%3E%3Chtml%3E%3Chead%3E%3Ctitle%3EDescription%20of%20the%20Logo%3C/title%3E%3C/head%3E%3Cbody%3E%3Cp%3ESome%20description%20goes%20here%3C/body%3E%3C/html%3E">
<div id="w3codebox_Explained">
  <h2>Image sun.gif</h2>
  <p>Description of the image.../p>
</div>
</body>
</html>
Test and see ‹/›

Browser Compatibility

IEFirefoxOperaChromeSafari

Almost all mainstream browsers do not support the longdesc attribute.

Definition and Usage

HTML5 The <img> longdesc attribute is not supported.

The longdesc attribute specifies a hyperlink to the detailed description of the image.

Tip:Since browsers have very poor support for the longdesc attribute, there is no need to use it. If you need to provide a long description for an image (if necessary), simply create a link to the description page (which is visible to anyone).

Syntax

<img longdesc="URL">

Attribute value

ValueDescription
URLDetailed description of the image linked by the hyperlink.
Possible values:
One ID for another element
Absolute URL  - Points to another website (such as LONGDESC = 'http:')//www.example.com/description.txt')
Relative URL  - Points to a file within a website (such as LONGDESC = 'description.txt')
 HTML <img> tag