html'typeof'属性是做什么的? [英] What does the html 'typeof' attribute do?

查看:155
本文介绍了html'typeof'属性是做什么的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近遇到了一个关于SO的问题,其中 typeof =foaf:person被用作元素的属性。我使用谷歌搜索,但 是唯一相关的结果。 这个小提琴 也使用 typeof 属性。请解释一下这个属性是如何以及为什么被使用的?

标记语言,这恰好可以用作HTML或XHTML的一部分。它用于为您的数据指定更多元数据。 RDF的命名空间之一是FOAF(这是你的 foaf:person ),在这里描述 - http://xmlns.com/foaf/spec/ 。它是语义网络运动的一部分,它基本上试图包含关于网络数据的语义信息(与添加HTML5的方式相同,例如文章标签)。所以通过标记例如。一个跨度与你的属性,你说这个跨度的内容应该被解释为一个人,并通过增加更多的属性,你可以告诉那个人的东西名称或主页等。这使得对数据(尤其是机器)的数据容易理解,并消除了一些不明确之处。


I recently came across a question on SO in which typeof="foaf:person" was used as an attribute for an element. I Googled for it but this was the only relevant result. This fiddle too uses the typeof attribute. Would some one please explain me how and why this attribute is used?

解决方案

It's not a HTML attribute, it's RDF, an unrelated markup language, that happens to be usable as part of HTML or XHTML. It's used to specify more metadata to your data. One of the namespaces of RDF is FOAF (that's your foaf:person), described here - http://xmlns.com/foaf/spec/.

It's part of the "semantic web movement", which basically tries to include semantic information about the web data (the same way HTML5 added eg. the article tag). So by tagging eg. a span with your attribute, you're saying that the content of that span should be interpreted as a person, and by adding more attributes, you can tell that something is that person's name, or homepage etc. This allows for easy understanding of data, especially for machines, and removes some of the ambiguity.

这篇关于html'typeof'属性是做什么的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆