Html 元名称和元属性有什么区别?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22350105/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What's the difference between meta name and meta property?
提问by weaveoftheride
Two common meta
element attributes are:
两个常见的meta
元素属性是:
<meta name="" content="">
and
和
<meta property="" content="">
what is the difference between meta name and meta property?
元名称和元属性有什么区别?
采纳答案by unor
The name
attribute is the "usual" way for specifying metadata in HTML. It's defined in the HTML5 spec.
该name
属性是在 HTML 中指定元数据的“通常”方式。它在 HTML5 规范中定义。
The property
attribute comes from RDFa.
该property
属性来自RDFa。
RDFa 1.1 extends HTML5 so that it's valid to use meta
and link
elements in the body
, as long as they contain a property
attribute.
RDFa 1.1 扩展了 HTML5,因此只要它们包含属性,就可以使用meta
和 中的link
元素body
property
。
You can use both ways, HTML5's name
and RDFa's property
, together on the same meta
element.
您可以使用两种方式,HTML5的name
和RDFa的property
,一起上相同meta
元素。
Note that you might also see meta
elements with an itemprop
attribute. That would be from Microdata.
请注意,您可能还会看到meta
带有itemprop
属性的元素。那将来自Microdata。