Html5 validation error output

I tried to check my html5 document, although I am getting some invalid markup errors.

My code is as follows:

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <!--[if lt IE 7 ]><html class="ie ie6" lang="en"> <![endif]--> <!--[if IE 7 ]><html class="ie ie7" lang="en"> <![endif]--> <!--[if IE 8 ]><html class="ie ie8" lang="en"> <![endif]--> <!--[if (gte IE 9)|!(IE)]><!--> <html lang="en"> <!--<![endif]--> <head> <meta charset="utf-8"> <title>index</title> <meta name="description" content=""/> <link rel="stylesheet" href="assets/css/base.css"> <script type="text/javascript" src="assets/js/jquery-1.6.1.min.js"></script> <script type="text/javascript" src="assets/js/jquery-ui-1.8.16.custom.min.js"></script> </head> 

Errors:

  Line 7, Column 16: application/xhtml+xml is not an appropriate Content-Type for a document whose root element is not in a namespace. **<html lang="en">** Line 7, Column 16: Unnamespaced element html not allowed in this context. (Suppressing further errors from this subtree.) **<html lang="en">** Line 16, Column 3: required character (found h) (expected l) **</head>** 

Some expert recommendations will be highly appreciated.

Thanks Patrick

+4
source share
2 answers

HTML5 is not HTML XHTML (XML), so <?xml ... ?> Causes validation problems (as Aaron already said)

+2
source

Just add the XHTML namespace to the html element, for example: <html lang="en" xmlns="http://www.w3.org/1999/xhtml"> .
Your code is still invalid because you forgot to add extra backslashes to void elements (meta and link).

+1
source

Source: https://habr.com/ru/post/1399529/


All Articles