Microdata in XHTML 1.1: there is no attribute “itemprop”

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 13:35:58

问题


I added Microdata to the product pages of my site. That leads to some errors. One of these errors is the following:

there is no attribute "itemprop"

The error is related to this source code line:

<div itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">

My Doctype is as follows:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

How would it be possible to make the page W3C compliant when keeping the same Doctype?


回答1:


Microdata can only be used in (X)HTML5.

If you want to use the Schema.org vocabulary in XHTML 1.1, you could use RDFa, but this would require changing the DOCTYPE to

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.1//EN" 
 "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd">

(See my answer about differences between Microdata and RDFa.)



来源:https://stackoverflow.com/questions/27506572/microdata-in-xhtml-1-1-there-is-no-attribute-itemprop

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