Rutwick Gangurde Rutwick Gangurde - 2 years ago 98
HTML Question

What does the html 'typeof' attribute do?

I recently came across a question on SO in which

was used as an attribute for an element. I Googled for it but this was the only relevant result. This fiddle too uses the
attribute. Would some one please explain me how and why this attribute is used?

Answer Source

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 -

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download