Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stray start tag HTML in validator?

I am trying to validate this HTML document in http://validator.w3.org/#validate_by_input but I am getting the following errors:

Line 3, Column 47: Stray start tag html.

<!--[if IE 7]><!--><html lang="en" class="ie7"><!--<![endif]-->

Line 4, Column 47: Stray start tag html.

<!--[if IE 8]><!--><html lang="en" class="ie8"><!--<![endif]-->

Line 5, Column 47: Stray start tag html.

<!--[if IE 9]><!--><html lang="en" class="ie9"><!--<![endif]-->

Line 6, Column 46: Stray start tag html.

<!--[if (gt IE 9)|!(IE)]><!--><html lang="en"><!--<![endif]-->

This is the HTML I am inputting:

<!DOCTYPE html>
<html lang="en-US">
<!--[if IE 7]><!--><html lang="en" class="ie7"><!--<![endif]-->
<!--[if IE 8]><!--><html lang="en" class="ie8"><!--<![endif]-->
<!--[if IE 9]><!--><html lang="en" class="ie9"><!--<![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--><html lang="en"><!--<![endif]-->
<head>
<title>Test</title>
</head>
<body>
</body>
</html>

Any ideas where I'm going wrong?

like image 547
Bonnie Avatar asked Apr 20 '13 18:04

Bonnie


People also ask

What is stray start tag HTML?

A stray start tag <html> has been found in the document. As this tag defines the start of the whole HTML document, it should appear only once. script.

What is stray start tag footer?

The validator says “Stray start tag footer” because the start tag appears in a context where no elements can be started – after the </body> tag, where only the optional </html> tag may appear. Follow this answer to receive notifications.

What is fatal error in HTML?

A fatal error is an error that causes a program to terminate without any warning or saving its state. A fatal error, upon occurring, aborts the application currently running, and may cause the user to lose any unsaved changes made in the program.

How do you fix no P element in scope but AP End tag seen?

You need to close the nested elements before you close the <li> . A closing tag </li> has been found, but there were open elements nested inside the <li> . You need to close the nested elements before you close the <li> .


3 Answers

Correct conditional comments:

<!--[if IE 7]><html lang="en" class="ie7"><![endif]-->
<!--[if IE 8]><html lang="en" class="ie8"><![endif]-->
<!--[if IE 9]><html lang="en" class="ie9"><![endif]-->
<!--[if (gt IE 9)|!(IE)]><html lang="en"><![endif]-->
<!--[if !IE]><html lang="en-US"><![endif]-->
like image 122
Ozerich Avatar answered Oct 25 '22 01:10

Ozerich


You don't close them. That's all and you define 2 html tags now.

like image 41
Rob Avatar answered Oct 25 '22 01:10

Rob


You start with a html-tag that's always present and then you add html-tags depending on version of IE so you might very well end up with multiple html-tags.

like image 41
Jensd Avatar answered Oct 25 '22 02:10

Jensd