简体   繁体   中英

I can't see the mistake in my HTML file

I tried to validate my HTML code but I got this error:

Line 157, Column 22: document type does not allow element "div" here; missing one of "object", "applet", "map", "iframe", "button", "ins", "del" start-tag <div class="details">

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> ").

but I cant see any mistake in my code, so I am asking for help...

<!--Bar 3-->

<div class="mosaic-block bar3">

<a href="http://www.desktopped.com/featured/2010/09/multi-d isplay-setup-with-four-systems-and-a-whole-lot-of- screen-space/" target="_blank" class="mosaic-overlay">

<div class="details">

<h4>Multi-Display Setup With Four Systems, A Wall of Screens, And 64TB Of Storage</h4>

<p>via Desktopped</p>

</div>

</a>

<a href="http://www.nonsensesociety.com/2010/12/i-am-not-hu man-portraits/" target="_blank" class="mosaic-backdrop"><img src="http://buildinternet.s3.amazonaws.com/projects/mos aic/64tb.jpg" alt="fotka1"/></a>

</div>

Blocks can't be placed in inline elements. In this case a is inline, and div is block, so <a><div></div></a> is invalid HTML.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM