2016-07-22 59 views
1

我想在HTML中做一個嵌套列表並在https://validator.w3.org上驗證它。當我驗證它時,我充滿了關於如何嵌套標籤的錯誤。HTML腳本沒有正確驗證

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

通過對計算器,我發現這個(correct semantics for ul in ul)的職位,說我應該巢我在李UL標籤,但我發現,這並沒有給我想要的東西,這是同樣的結果一些帖子細算我目前有,但我也希望它能夠正確驗證。任何人都可以幫助使用正確的格式,以便正確驗證嗎?

回答

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>

我已經修改了一些標籤,現在它的正常工作。

+0

仍然在驗證器上正確驗證 – xan

+1

確定您的上一個u1錯過了「>」,但運行良好,謝謝 – xan

0

<meta charset="utf-8" />

不應該Meta標籤是那個?

+0

也許,我仍然收到錯誤 – xan

+0

不,OP的來源不是XHTML。 –