2

我想知道在链接图像上实现标题和 alt 的最佳方法是什么。

img-tag 可以同时具有 title 和 alt 属性,a-tag 只能具有 title 属性。链接图像时,实现标题属性的最佳方法是什么?我应该把它放在 img 和 a-tag 上还是只放在两者之一上?

4

1 回答 1

1

他们有不同的方法。title-attribute 向元素添加描述,alt-attribute 表现为图像的替代文本表示。

<a href="..." title="Click here for more information about VanGogh">
    <img src="vangogh.png" alt="Famous painting of VanGogh" />
</a>
于 2013-01-03T10:59:50.230 回答