Click to See Complete Forum and Search --> : Inexplicable "end tag validation error"


javascriptlover
12-06-2008, 09:09 AM
"Line 40, Column 7: end tag for element "div" which is not open."

I can see what's happening in the code, I just can't see why!

I have a (red) div tag wrapping around the entire contents of everything in my html's body. The thing is, the browsers think it ends at the blue div below - way before where it should, ie just before the final </body> tag.

Any idea how I can make my container div tags - the red ones below - more clear to the browsers?

Thanks


<body>
<div id="container">

<div id="image">
<img src="dog.gif" alt="my dog" />
</div>

<h1>The happyiest dawg</h1>

<div id="introduction">
<h2> Lorem ipsum blah blah blah</h2></div>
</div>

<div id="information">
Lorem ipsum blah blah blah
</div>

</div>
</body>

ryanbutler
12-06-2008, 09:47 AM
Oh, I see it. Right before your blue closing DIV tag, you have another closing DIV tag after the h2 in the introduction DIV. As a result, the browser sees that closing DIV tag, then the blue one and thinks the blue is the end of the line for your container tag, which in this context it is. Get rid of your blue DIV and you should be fine.

coothead
12-06-2008, 09:56 AM
Hi there javascriptlover,

I counted four opening div tags and five closing div tags. ;)

If your eyes can only discern four, I would hazard a guess that you have
overlooked the closing div tag that immediately follows the closing h2 tag. ;)

coothead

javascriptlover
12-06-2008, 10:55 AM
Hahaha, I'm such an idiot!!! Thanks all.

coothead
12-06-2008, 11:23 AM
Don't be so hard on yourself, just book an early appointment at your local optician. :D

coothead

WebJoel
12-06-2008, 03:08 PM
Computers are so smart they will do exactly what yo tell them to do, -but seldom what you want them to do...

Yes, that middle "div" has a closing... I looked at this for like a minute before I spotted it too! :D