Do I still need to use the title attribute if my e

2019-06-26 08:43发布

I have a piece of code like this:

<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>

Is it necessary for me to specify the title attribute in addition to the figcaption element, and will not doing so result in SEO problems?

2条回答
Melony?
2楼-- · 2019-06-26 09:17

Figcaption is enough. But you may need to specify title if you have to apply microformats like vCard: http://www.rachaelmoore.name/web-design/microformats/marking-up-contact-information-semantic-using-html5-microformat/

查看更多
聊天终结者
3楼-- · 2019-06-26 09:18

Title attribute is mainly for providing a tooltip about what is that image or link about. Usually a the target's title.

In the images, using figcaption should be enough to overcome title attribute, hence you have a specific markup for describing the resource. Howver consider always using ALT attribute, even with figcaption.

This is because you can have more than one image in a figure.

For example, using 3 images for ilustrating progress on a process.

<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>
查看更多
登录 后发表回答