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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 01:13:25  来源:igfitidea点击:

What's the difference between meta name and meta property?

htmlmetadatameta

提问by weaveoftheride

Two common metaelement attributes are:

两个常见的meta元素属性是:

<meta name="" content="">

and

<meta property="" content="">

what is the difference between meta name and meta property?

元名称和元属性有什么区别?

采纳答案by unor

The nameattribute is the "usual" way for specifying metadata in HTML. It's defined in the HTML5 spec.

name属性是在 HTML 中指定元数据的“通常”方式。它在 HTML5 规范中定义

The propertyattribute comes from RDFa.

property属性来自RDFa

RDFa 1.1 extends HTML5 so that it's valid to use metaand linkelements in the body, as long as they contain a propertyattribute.

RDFa 1.1 扩展了 HTML5,因此只要它们包含属性,就可以使用meta和 中的link元素bodyproperty

You can use both ways, HTML5's nameand RDFa's property, together on the same metaelement.

您可以使用两种方式,HTML5的name和RDFa的property一起上相同meta元素

Note that you might also see metaelements with an itempropattribute. That would be from Microdata.

请注意,您可能还会看到meta带有itemprop属性的元素。那将来自Microdata