我经常看到的使用 Schema.org Microdata 的示例使用了很多额外的 span
元素,如下所示:
<span itemprop="telephone">
<a href="tel:+18506484200">
850-648-4200
</a>
</span>
额外的 span
元素真的有必要吗?或者将 itemprop
放在 a
标记中是否可以接受?就像这样:
<a href="tel:+18506484200" itemprop="telephone">
850-648-4200
</a>
后一个示例看起来更清晰,但我看到的示例似乎总是使用单独的 span
元素。
最佳答案
span
元素将生成一个 Text
值,a
元素将生成一个 URL
值 ( details )。
Schema.org 的 telephone
属性需要一个 Text
值:
Values expected to be one of these types
Text
请注意,您不必遵循此建议。可以使用非预期的值。还有一个问题也要求获取 URL
值:Make the telephone property more structured (not just Text)。
关于html - Schema.org 电话链接是否需要包装跨度元素?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42563142/