属性属性的 HTML 验证错误

2022-01-17 00:00:00 http-headers html

我正在使用一些 facebook 社交插件,并且正在使用元标题.验证页面时,W3C 验证器抛出错误 -> 错误:没有属性属性".

I am using few facebook social plugins and I am using the meta header. When validating the page, the W3C validator is throwing the error -> "Error: there is no attribute "property".

我正在使用 XHTML 过渡文档类型 - <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

I am using the XHTML Transitional doctype - <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

请建议我是否必须将文档类型更改为其他内容.

Pls Suggest if I have to change the doctype to something else.

推荐答案

Facebook的插件使用Open Graph,它是内置的在 RDFa 上.是 RDFa 将 property 属性添加到元素.没有这个添加,纯 HTML 就没有这样的属性.(如果你问我,添加一个新属性而不给它命名空间,并重复使用 <meta> 标记的一半,这是一个奇怪的设计.但没有人这样做.)

Facebook's plugins use Open Graph, which is built on RDFa. It's RDFa that adds the property attribute to elements. Without this addition, plain HTML has no such attribute. (If you ask me, it's a strange design to add a new attribute without namespacing it, and to re-use half of a <meta> tag. But no-one did.)

要验证 XHTML-with-RDFa,您需要 DOCTYPE:

To validate XHTML-with-RDFa, you'll need the DOCTYPE:

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

这意味着您必须编写有效的 XHTML 1.1.更多

This means you will have to be writing valid XHTML 1.1. More

相关文章