我想知道在链接图片上实现标题和替代选项的最佳方式是什么。
img-tag 可以同时具有 title 和 alt 属性,a-tag 只能具有 title 属性。 链接图像时,实现标题属性的最佳方式是什么? 我应该把它同时放在 img 和 a-tag 上还是只放在两者之一上?
最佳答案
他们有不同的方法。 title-attribute 向元素添加描述,alt-attribute 表现为图像的替代文本表示。
<a href="..." title="Click here for more information about VanGogh">
<img src="vangogh.png" alt="Famous painting of VanGogh" />
</a>
关于html - 如何在链接图像上实现标题属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14137464/