2011-12-11 26 views
0

驗證我的網站時出現100錯誤。我不想繼續構建,直到我解決這個問題。我已經逐行了,我不明白爲什麼我有這些問題。粗略起草頁面在www.flynntec.com。一個例子錯誤:其次文檔類型不允許元素問題

The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element.

One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").

樣本HTML

document type does not allow element "h3" here; assuming missing "li" start-tag [XHTML 1.0 Transitional]

document type does not allow element "li" here; missing one of "ul", "ol", "menu", "dir" start-tag [XHTML 1.0 Transitional]

<li class="menu_right"><a href="#" class="drop">Access</a> 

    <div class="dropdown_5columns align_right"> 

     <div class="col_5"> 
      <h2>Microsoft Access</h2> 
     </div> 

     <div class="col_1"> 
     <img src="media/Access Logo.png" width="120" height="118" alt="Microsoft Access" /> 
     </div> 

     <div class="col_1"> 
      <ul class="greybox"><h3>Beginner</h3><li><a href="#">Welcome to Access</a></li> 
       <li><a href="#">The Power of Access</a></li> 
       <li><a href="#">Intro to Databases</a></li> 
       <li><a href="#">Intro to Tables</a></li> 
       <li><a href="#">Creating Forms</a></li> 
       <li><a href="#">More...</a></li> 
      </ul> 
     </div> 
     <div class="col_1"> 
      <ul class="greybox"><h3>Intermediate</h3><li><a href="#">Custom Queries</a></li> 
       <li><a href="#">Create Reports</a></li> 
       <li><a href="#">Primary Key Guide</a></li> 
       <li><a href="#">Filtering Quickly</a></li> 
       <li><a href="#">More...</a></li> 
      </ul> 
     </div> 

     <div class="col_1"> 
      <ul class="greybox"><h3>Advanced</h3><li><a href="#">Web Integration</a></li> 
       <li><a href="#">Advanced Forms</a></li> 
       <li><a href="#">Using Triggers</a></li> 
       <li><a href="#">Shortcuts</a></li> 
       <li><a href="#">Expression Builder</a></li> 
       <li><a href="#">More...</a></li> 
      </ul> 
     </div> 

     <div class="col_5"> 
      <h2>Additional Free Resources</h2> 
     </div> 

     <div class="col_3"> 

      <img src="media/youtube-logo.jpg" alt="YouTube Picture" name="youtube" width="90" height="70" class="img_left imgshadow" id="youtube_logo_2" /> 
      <p>Microsoft Access is an ideal small-business database engine. YouTube is a great source for Access guides. We have compiled the best, most popular Access tutorials from YouTube and put them here for your convenience. </p> 

      <br /> 
      <a href="http://office.microsoft.com/en-us/training-FX101782702.aspx" target="_blank"><img src="media/microsoft-logo__111129012732.jpg" alt="" name="microsoft" width="90" height="24" class="img_left imgshadow" id="microsoft_logo_2" /></a> 
      <p><a href="http://office.microsoft.com/en-us/training-FX101782702.aspx" title="Microsoft Training" target="_blank">Microsoft has fantastic resources on their website. Microsoft Training can be found here.</a></p> 
</div> 
</div> 
</li> 

是的,有被打開和關閉UL的。

+2

爲什麼XHTML嚴格的文檔類型?有必要嗎?你能用HTML5 doctype <!DOCTYPE html>嗎? – danludwig

+0

我從來沒有考慮過它 - 什麼是適當的語法使用? – jdflynn55

+0

<!DOCTYPE html>< - 將此作爲第一行,您當前的文檔類型是。 – danludwig

回答

2

不能直接有一個H3元素中UL - 這應該已經解決大部分的驗證錯誤...

2

可以清楚地錯誤 - 它需要是一個立中,或UL之前狀態,您的HTML無效。

<ul> s只能(直接)包含<li> s。

2

<ul>標籤僅用於放置<li>標籤,爲什麼不在<ul>元素之前放置<h3>

3

某些HTML元素只能包含某些其他HTML元素。 UL只能包含LI元素,因此UL中的H3是錯誤的。
將H3移出UL,或將其放入LI中。
你想達到什麼效果?

此外,即使您的網頁認爲它是XHTML過渡版,您仍在使用text/html MIME類型,因此瀏覽器會將其視爲HTML。 如果您確實需要XHTML,請確保MIME類型爲application/xhtml+xml。但是,舊版本的IE不會顯示它。

+0

H3有一個邊框底部,當鼠標懸停在任何菜單欄上時,會導致新手在它下面有一個漂亮的線條。 – jdflynn55

+0

@ jdflynn55我相信大約有10種其他方式可以實現同一條線。 – kapa

1

XHTML Transitional正在抱怨,因爲您有一個<h3>直接位於<ul>的內部,而不包含在<li>中。這實際上是不好的做法。

<ul class="greybox"><h3>Beginner</h3><li><a href="#">Welcome to Access</a></li> 
       <li><a href="#">The Power of Access</a></li> 
       <li><a href="#">Intro to Databases</a></li> 
       <li><a href="#">Intro to Tables</a></li> 
       <li><a href="#">Creating Forms</a></li> 
       <li><a href="#">More...</a></li> 
      </ul> 
1

你有h3的直接在ul的開始。他們需要在名單之外,我們在裏面。

相關問題