HTML5 microdata: span content?

穿精又带淫゛_ 提交于 2019-11-27 02:11:56
unor

Yes, this is wrong. Neither Microdata nor HTML5 define a content attribute for the span element.

Several people wanted to use it, see for example the code in these questions:

I’m not sure where exactly this confusion is coming from.

(It doesn’t help that Google’s Structured Data Testing Tool incorrectly uses the content attribute instead of the element content; but at least all other Microdata parsers seem to do it correctly.)

Maybe some people got confused because RDFa (but not Microdata) defines and allows the content attribute for span. See HTML+RDFa’s Extensions to the HTML5 Syntax:

For the avoidance of doubt, the following RDFa attributes are allowed on all elements in the HTML5 content model: @vocab, @typeof, @property, @resource, @prefix, @content, @about, @rel, @rev, @datatype, and @inlist.

Luneya

(Sorry, I didn't have enough reputation to post a comment.)

We're at the end of 2017 now. Somehow, the MDN webdocs (https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/itemprop) and the schema docs (http://schema.org/telephone) still propose to use a content attribute on span using microdata. No html5 validator will accept this of course.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!