2016-07-22 95 views
1

Ich versuche, eine verschachtelte Liste in HTML zu tun und validieren Sie auf https://validator.w3.org. Wenn ich es validiere, bekomme ich viele Fehler darüber, wie ich meine Tags neste.HTML-Skript nicht ordnungsgemäß überprüfen

<!DOCTYPE html> 
<html lang ="en"> 
<head> 
<meta charset="utf-8"> 
<title>Ex 2</title> 
</head> 
<body> 
<ul> 
<li>Outer-1 
<li>Outer-2</li> 
<ul> 
<li>Inner-1 
<li>Inner-2</li> 
<li>Inner-3</li> 
<ul> 
<li>Deep-1</li> 
</ul> 
</li> 
<li>Inner-4 
<ul> 
<li>Deep-2</li> 
</ul> 
</li> 
</ul> 
</li> 
<li>Outer-3</li> 
</ul> 
<ul> 
<li style = "list-style-type: decimal">Outer-1 
<li style = "list-style-type: decimal">Outer-2</li> 
<ul> 
<li style = "list-style-type: lower-alpha">Inner-1 
<li style = "list-style-type: lower-alpha">Inner-2</li> 
<ul> 
<li style = "list-style-type: lower-roman">Deep-1</li> 
<li style = "list-style-type: lower-roman">Deep-2</li> 
</ul> 
</li> 
</ul> 
</li> 
<li style = "list-style-type: decimal">Outer-3</li> 
<ul> 
<li style = "list-style-type: lower-roman">Inner-3</li> 
</ul> 
</ul> 
</body> 
</html> 

Nach einigen Stellen der Suche durch auf Stackoverflow ich diesen (correct semantics for ul in ul) Beitrag gefunden, dass ich Nest meine ul-Tags in li sagt, aber ich fand, dass das, was ich will, nicht das gleiche Ergebnis geben, das, was Ich habe momentan aber ich will es auch richtig validieren. Kann jemand mit dem korrekten Format helfen, damit es richtig validiert?

Antwort

1

<!DOCTYPE html> 
 
<html lang ="en"> 
 
    <head> 
 
    <meta charset="utf-8"> 
 
    <title>Ex 2</title> 
 
    </head> 
 
    <body> 
 
    <ul> 
 
     <li>Outer-1</li> 
 
     <li>Outer-2 
 
     <ul> 
 
     <li>Inner-1 
 
     <li>Inner-2</li> 
 
     <li>Inner-3 
 
     <ul> 
 
      <li>Deep-1</li> 
 
     </ul> 
 
     </li> 
 
     <li>Inner-4 
 
     <ul> 
 
      <li>Deep-2</li> 
 
     </ul> 
 
     </li> 
 
    </ul> 
 
    </li> 
 
    <li>Outer-3</li> 
 
    </ul> 
 
<ul> 
 
    <li style = "list-style-type: decimal">Outer-1</li> 
 
    <li style = "list-style-type: decimal">Outer-2 
 
    <ul> 
 
    <li style = "list-style-type: lower-alpha">Inner-1</li> 
 
    <li style = "list-style-type: lower-alpha">Inner-2 
 
    <ul> 
 
     <li style = "list-style-type: lower-roman">Deep-1</li> 
 
     <li style = "list-style-type: lower-roman">Deep-2</li> 
 
    </ul> 
 
    </li> 
 
    </ul> 
 
    </li> 
 
    <li style = "list-style-type: decimal">Outer-3</li> 
 
</ul>

Ich habe einige Tags geändert und jetzt ist es funktioniert gut.

+0

überprüft immer noch richtig auf dem Validator – xan

+1

ok Ihre letzte u1 fehlte ein ">" aber funktioniert gut, danke – xan

0

<meta charset="utf-8" />

Sollte nicht Meta-Tag das sein?

+0

vielleicht, bekomme ich immer noch Fehler obwohl – xan

+0

Nein, die OP-Quelle ist nicht XHTML. –