2013-04-20 9 views
9

Sto tentando di convalidare questo documento HTML in http://validator.w3.org/#validate_by_input ma sto ricevendo i seguenti errori:Tag di inizio stray HTML in validator?

Riga 3, colonna 47: tag di inizio stallo html.

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

Riga 4, Colonna 47: tag di inizio stallo html.

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

Riga 5, Colonna 47: tag di inizio stallo html.

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

Riga 6, Colonna 46: tag di inizio stallo html.

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

Questo è il codice HTML sto inserendo:

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

Tutte le idee dove sto andando male?

risposta

7

Correggere i commenti condizionali:

<!--[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]--> 
+0

Sì. Per chiarire, i tag '' non sono realmente condizionali nel codice dell'OP. Per uno user agent non IE, sono tutti visibili. –

+0

Grazie. Certo - mi sento sciocco ora. Ora funziona perfettamente! – Bonnie

3

Lei non li chiudono. Questo è tutto e ora definite 2 tag html.

1

Si inizia con un tag html sempre presente e si aggiungono tag html a seconda della versione di IE, quindi si potrebbe finire con più tag html.

+0

Grazie! La soluzione di Ozerich e la tua spiegazione mi hanno aiutato a capire dove stavo sbagliando. Grazie molto. – Bonnie

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

Utilizzare questo file e quindi avviare tag ...