如果我的元素有“
”,我还需要使用 title 属性吗?

2023-12-23

我有一段这样的代码:

<figure>
    <img title="An amazing image that I forgot to specify a url for"/>
    <figcaption>An amazing image that I forgot to specify a url for</figcaption>
</figure>

我是否需要指定title属性除了figcaption元素,这样做会不会造成SEO问题?


标题属性主要用于提供有关该图像或链接的内容的工具提示。通常是目标的头衔。

在图像中,使用Figcaption应该足以克服标题属性,因此您有一个特定的标记来描述资源。然而,请考虑始终使用 ALT 属性,即使使用Figcaption。

这是因为一张图中可以有多个图像。

例如,使用 3 个图像来说明流程的进度。

<figure>
<img src="img1.png" alt="The start of process. Subject is raw." />
<img src="img2.png" alt="Middle process. Subject is changing." />
<img src="img3.png" alt="End of process. Subject is completely transformed." />
<figcaption>Process steps, from left to right: raw subject, changing and changed subject.</figcaption>
</figure>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如果我的元素有“
”,我还需要使用 title 属性吗? 的相关文章

随机推荐