【问题标题】:Do I still need to use the title attribute if my element has a `<figcaption>`?如果我的元素有 `<figcaption>`,我还需要使用 title 属性吗?
【发布时间】:2010-09-26 18:45:44
【问题描述】:

我有一段这样的代码:

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

除了figcaption元素之外,我是否有必要指定title属性,这样做不会导致SEO问题?

【问题讨论】:

    标签: html seo semantics semantic-markup


    【解决方案1】:

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

    在图像中,使用 figcaption 应该足以克服 title 属性,因此您有一个特定的标记来描述资源。但是请考虑始终使用 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>
    

    【讨论】:

      【解决方案2】:

      Figcaption 就足够了。但是,如果您必须应用 vCard 等微格式,则可能需要指定标题: http://www.rachaelmoore.name/web-design/microformats/marking-up-contact-information-semantic-using-html5-microformat/

      【讨论】:

        猜你喜欢
        • 2012-06-08
        • 1970-01-01
        • 2022-11-20
        • 1970-01-01
        • 2011-10-16
        • 2021-10-24
        • 1970-01-01
        • 1970-01-01
        • 2012-01-17
        相关资源
        最近更新 更多