Bonnie
Bonnie

Reputation: 113

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?

Upvotes: 9

Views: 38187

Answers (4)

user5104334
user5104334

Reputation: 1

<!DOCTYPE html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->

Use this file and then start tag...

Upvotes: -2

Jensd
Jensd

Reputation: 8011

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.

Upvotes: 1

Rob
Rob

Reputation: 3574

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

Upvotes: 3

Ozerich
Ozerich

Reputation: 2000

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

Upvotes: 7

Related Questions