longdesc属性指定指向图像详细描述的超链接。
有关如何使用longdesc属性的几个示例:
<!DOCTYPE html>
<html>
<head>
<title>HTML:<img> longdesc 属性 - 森客兔子 (thinktus.com)</title>
<body>
<!-- The description is on the same page as the image -->
<img src="sun.gif" alt="(thinktus.com)" width="100" height="132" longdesc="#nhooo_Explained">
<!-- The description is in an external page -->
<img src="sun.gif" alt="(thinktus.com)" width="100" height="132" longdesc="nhooo.txt">
<!-- The description is one of several within an external page -->
<img src="sun.gif" alt="(thinktus.com)" width="100" height="132" longdesc="http://example.com/desc#item3">
<!-- The description is included in a data:URI -->
<img src="sun.gif" alt="(thinktus.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="nhooo_Explained">
<h2>Image sun.gif</h2>
<p>Description of the image...</p>
</div>
</body>
</html>
测试看看 ‹/›IEFirefoxOperaChromeSafari
几乎所有的主流浏览器都不支持 longdesc 属性。
HTML5 不支持 <img> longdesc 属性。
longdesc属性指定指向图像详细描述的超链接。
提示:由于浏览器对 longdesc 属性的支持性非常差,没有必要使用该属性。如需为某个图像提供长描述(如果有必要的话),只要简单地创建一个指向描述页面的链接即可(该链接对任何人都是可见的)。
<img longdesc="URL">
值 | 描述 |
---|---|
URL | 超链接到的图像的详细说明。 可能的值: 一个ID另一个元素 绝对URL - 指向另一网站(如LONGDESC =“http://www.example.com/description.txt”) 相对URL - 指向一个网站内的文件(如LONGDESC =“description.txt”) |