HTML <img> longdesc Attribute

Example

Several examples of how to use the longdesc attribute:

<!– The description is on the same page as the image –>
<img src=”https://dwfaisalabad.com/wp-content/uploads/2017/08/DWF.png” alt=”DW.com” width=”100″ height=”100″ longdesc=”#w3htmlExplained”>

<!– The description is in an external page –>
<img src=”https://dwfaisalabad.com/wp-content/uploads/2017/08/DWF.png” alt=”DW” width=”100″ height=”100″ longdesc=”w3html.txt”>

<!– The description is one of several within an external page –>
<img src=”https://dwfaisalabad.com/wp-content/uploads/2017/08/DWF.png” alt=”DW” width=”100″ height=”100″ longdesc=”http://example.com/desc#item3″>

<!– The description is included in a data:URI –>
<img src=”https://dwfaisalabad.com/wp-content/uploads/2017/08/DWF.png” alt=”DW” width=”100″ height=”100″ longdesc=”www.dwfaisalabad.com/downloads/dw.txt”>

<div id=”htmlExplained”>
<h2>Image html.gif</h2>
<p>Description of the image…</p>
</div>

Try it Yourself »


Definition and Usage

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


Browser Support

Attribute
longdesc Not supported Not supported Not supported Not supported Not supported

Syntax

<img longdesc=”string“>

Attribute Values

Value Description
string A hyperlink to a detailed description of an image.

Possible values:

  • An id to another element
  • An absolute URL – points to another web site (like longdesc=”http://www.example.com/description.txt”)
  • A relative URL – points to a file within a web site (like longdesc=”description.txt”)

Post Author: Zahid Farid