Castor
Castor

Reputation: 1933

Html validation error for property attribute

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".

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.

Upvotes: 33

Views: 25671

Answers (3)

Timofey Drozhzhin
Timofey Drozhzhin

Reputation: 4714

As Open Graph suggests, if you're using HTML5, you're better off just using a prefix attribute like this:

<!doctype html>
<html prefix="og: http://ogp.me/ns#">
  <head>
    <title>HTML5 site</title>
    <meta property="og:title" content="The Rock" />
  </head>
  <body>
  </body>
</html>

You can leave the doctype as is and it will validate.

This approach has also been recommended by an Open Graph developer.

Upvotes: 3

albert
albert

Reputation: 8153

In order for a document to claim that it is a conforming HTML+RDFa document, it must provide the facilities described as mandatory in this section. The document conformance criteria are listed below, of which only a subset are mandatory:

  1. All document conformance requirements stated as mandatory in the HTML5 specification must be met.
  2. There should be a version attribute on the html element. The value of the version attribute should be HTML+RDFa 1.0 if the document is a non-XML mode document, or XHTML+RDFa 1.0 if the document is a XML mode document.
  3. There may be a link element contained in the head element that contains profile for the the rel attribute and http://www.w3.org/1999/xhtml/vocab for the href attribute.

Example:

<html version="HTML+RDFa 1.1" lang="en">
  <head>
    <title>Example Document</title>
  </head>
  <body>
    <p>Moved to <a href="http://example.org/">example.org</a>.</p>
  </body>
</html>

Upvotes: 5

bobince
bobince

Reputation: 536379

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.)

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">

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

Upvotes: 43

Related Questions