...

View Full Version : Validation Error: end tag for element "div" which is not open



madmatter23
06-29-2010, 11:04 PM
Hello,

I've got a few pages on my web site that aren't working properly. The appearance is broken. The W3 validator informs me that:

"end tag for element "div" which is not open" occurs on various lines.

To me, this indicates that there must be an extra </div> tag accidentally inserted somewhere, but I can't find it.

Is there anything else that could be causing this?

I'm comparing working pages vs broken pages and can't identify the difference.

Here's a few broken pages:
http://grasmickwebdesign.com/no-crawl/landlords-solutions/contact-us
http://grasmickwebdesign.com/no-crawl/landlords-solutions/about-us

And a few working ones:
http://grasmickwebdesign.com/no-crawl/landlords-solutions/our-properties/office_property
http://grasmickwebdesign.com/no-crawl/landlords-solutions/properties/office-properties/662-howards-loop

I can't figure out what's wrong. Any help would be appreciated! Thanks!

BoldUlysses
06-29-2010, 11:13 PM
Holy hurricane of CSS links, Batman.

In other news, the validator gives you the complete line where error occurs, which should help you locate it in the HTML document.

One utility that might be helpful is HTML Tidy (http://infohound.net/tidy/). Run your HTML through there and examine the output. It's been helpful to me in the past in locating hard-to-find tags. If nothing else, it will nest your code properly for you so you can match up opening and closing tags easier.

madmatter23
06-29-2010, 11:16 PM
Thanks. I am using the validator's line specific information and running through line by line in dreamweaver, but it's still a bit of a mystery.

I says that, for instance, that div #main closed on line 389 is not open:


"Line 389, Column 16: end tag for element "div" which is not open

</div> <!-- /main -->"


Which means to me that it was accidentally closed earlier, but this information doesn't help me find the stray tag that's accidentally closing #main.

Everything seems to match up perfectly in Dreamweaver...

BoldUlysses
06-29-2010, 11:21 PM
Thanks. I am using the validator's line specific information and running through line by line in dreamweaver, but it's still a bit of a mystery.

I says that, for instance, that div #main closed on line 389 is not open:


"Line 389, Column 16: end tag for element "div" which is not open

</div> <!-- /main -->"


Which means to me that it was accidentally closed earlier, but this information doesn't help me find the stray tag that's accidentally closing #main.

Understood. This is an instance where properly-tabbed HTML would help you match up opening and closing tags, which would show you exactly where the extra tag is. HTML Tidy will clean up your HTML and tab it for you to make this easier.


Everything seems to match up perfectly in Dreamweaver...

Unfortunately, as you're discovering, DW is far from the "real world" of the web. :)

madmatter23
06-29-2010, 11:24 PM
Hm.. seems to match up correctly in HTML tidy as well... HTML tidy displays the same validator error, but there's no improperly indented div tags. I can't figure out what I'm missing.

BoldUlysses
06-29-2010, 11:39 PM
Hm.. seems to match up correctly in HTML tidy as well... HTML tidy displays the same validator error, but there's no improperly indented div tags. I can't figure out what I'm missing.

Are we seeing the same thing? I go to your first link:

http://grasmickwebdesign.com/no-crawl/landlords-solutions/contact-us

view source, copy everything and paste it into HTML Tidy. HTML Tidy outputs the code properly indented and automatically drops the extra </div> tags. Have you tried taking the HTML Tidy output and comparing it to the "uncorrected" code to see if the way the page looks in the browser window has changed? If the layouts are the same before and after, then you simply had a couple extra </div> tags which the browser ignored when it parsed the HTML.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum