开发者

Doctype Problems

I have problems, to set the correct Doc Type. Please have a look at my code above. it returns an error in the w3org validator. Where is the error?

<!DOCTYPE html>
<html x开发者_如何学Cmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://ogp.me/ns#" xmlns:fb="http://www.facebook.com/2008/fbml">
<html dir="ltr" lang="de-DE" xmlns:og="http://opengraphprotocol.org/schema/">
<head>

I found the solution:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" xmlns:og="http://opengraphprotocol.org/schema/" xmlns:fb="http://www.facebook.com/2008/fbml">
<head>


As suggested by @David Dorward, posting comment as an answer.

The <html> element is the root-element of the html document, and as such can only appear once in a valid html document. For the purposes of validity you could either just remove one of the <html> opening tags (and, if you have two </html> closing tags remove one of those too), or combine all the attributes into one and then remove the empty html tag (which isn't much of a difference to the previous option, really).

Also, but as an addenda, I'm unsure as to the use of the xml namespaces within an html document; given that it passed without comment, except for my own, in the comments to your question it's probably alright; but it...feels wrong. Which is about the worst explanation for anything I've ever put on this site. And I feel ashamed for it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜