Welcome to WebmasterWorld Guest from

Forum Moderators: incrediBILL

Message Too Old, No Replies

Extra Div when validating but only way it works



6:37 pm on Feb 18, 2011 (gmt 0)

5+ Year Member

Hi everyone the page in question is


There is an issue with code from a 3rd party when validating that i have attempted to contact but this post is about the 'extra' div.

I can't for the life of me figure out why this extra div is causing the problem in the validatior.

Line 516, Column 47: end tag for element "div" which is not open
</div>  </div><div class="clear"></div></div>

This causes
<div id="mainy">
The green background that is through the whole top section of the site to end and then allows the bottom
<div class="pageEdge">
<div class="pageBottom">

Etc to display the footer correctly. Removing that extra </div> doesnt terminate the mainy but validates?

an extra pair of eyes would be great!


8:23 pm on Feb 18, 2011 (gmt 0)

Maybe thinking too simple, but the comment seems obvious to me. You open a div then close it two times, so looking to it at that way an "end tag for element "div" (is used for a tag) which is not open".

A quick count of opening and closing tags of div's in your page learns that there is an equal amount of them, but I find your code a little hard to read. Being not familiar with your intentions there seem to be "empty div's" and a lot of nested div's, so someone (like me) that is new to the code easily looses track.
Maybe validating is a matter of looking at the structure of your page.


3:28 pm on Feb 19, 2011 (gmt 0)

5+ Year Member

this is a complicated template system built on outdated code yes... ive tried to go through it and find out where the extra div etc is.. but with no luck...

i hope someone else might have a glance through and see if they see it :)


6:58 pm on Feb 19, 2011 (gmt 0)

WebmasterWorld Senior Member suzyuk is a WebmasterWorld Top Contributor of All Time 10+ Year Member

ive tried to go through it and find out where the extra div etc is.. but with no luck...

I've tried looking at this twice with no luck.. even I can't match all that in my head - over 2000 lines! ;)

you mention about the 3rd party code.. have you actually tested and validated this 3rd party code in a blank HTML page to prove it's actually that that is generating the wrong code? did your page validate before adding this code?

Removing that extra </div> doesn't terminate the mainy but validates?

it's because it's not mainy that's the problem..

----- much later, 3rd time lucky

a) you need to pay me lots of money for this :)


b) search your source for the line (it's around line 100, despite the fact the validator can't reconcile it until line 513)

<div style="padding:2px;" /> &nbsp;</div>

c) find where your template is generating that code and change it to:

<div style="padding:2px;"> &nbsp;</div>

i.e. remove the self closing "space/" from the opening tag

PS: this wasn't just a glance, that's why you now owe me lots of money! :)


1:05 am on Feb 21, 2011 (gmt 0)

5+ Year Member

OMG SUZY! Suzy suzy suzy... i thank you completely!

That completely makes sense why the validator wasn't finding it... oi oi!

100% errors that remain are from the Text link ads generated code which sadly generates <TABLE> instead of <table> I emailed their support about it so hopefully they will make the code XHTML compliant.

Anyway... very much thank you again to suzyUK. You are seriously my hero :)

Featured Threads

Hot Threads This Week

Hot Threads This Month