homepage Welcome to WebmasterWorld Guest from 54.166.113.249
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

    
A tool for finding a code mistake?
justint



 
Msg#: 4397533 posted 7:41 pm on Dec 13, 2011 (gmt 0)

I have made a mistake in my code somewhere and have failed to close a tag or something like that. Thing is I just can't find that mistake. Does anyone know if there is a tool or something that can find the mistake for me?

Thanks

Justin

 

penders

WebmasterWorld Senior Member penders us a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



 
Msg#: 4397533 posted 8:12 pm on Dec 13, 2011 (gmt 0)

Try the W3C HTML Validator [validator.w3.org]

justint



 
Msg#: 4397533 posted 8:34 pm on Dec 13, 2011 (gmt 0)

Oh thanks, I tried that but got no answer :(

penders

WebmasterWorld Senior Member penders us a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



 
Msg#: 4397533 posted 8:45 pm on Dec 13, 2011 (gmt 0)

no answer == validated OK?

If you are validating against an HTML doctype then this does permit certain elements to be left open (they will be closed automatically - but not necessarily where you expect?) - so you won't necessarily get a validation error. However, if you are validating against an XHTML doctype then all your elements must be closed in the source, so the validator will catch any unclosed elements in this instance.

Do you think there is a mistake because it doesn't look as you expect?

g1smd

WebmasterWorld Senior Member g1smd us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4397533 posted 9:17 pm on Dec 13, 2011 (gmt 0)

The Firebug extension for Firefox allows you to inspect the DOM tree and temporarily change elements on the page and immediately see the effects.

justint



 
Msg#: 4397533 posted 9:21 pm on Dec 13, 2011 (gmt 0)

The formatting dies halfway down the page, but I use php includes and css and I am not sure where I have slipped up. will have a look at the firebug thing sounds good.

lucy24

WebmasterWorld Senior Member lucy24 us a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



 
Msg#: 4397533 posted 11:33 pm on Dec 13, 2011 (gmt 0)

By "formatting dies" do you mean that halfway through the page, it stops seeing your CSS? I'm impressed. I can do that easily for the whole page, but mid-page is harder.

The first place to look is the exact location where the formatting stops. And then start looking backward. That is, if your error happens in the middle of a series of <p class = "foobar"> then the problem may not become visible until the next time your html has to consult the CSS for something new.

Most obvious thing to look for: Are you using relative links to call your CSS? If so, does the page use the contents of more than one directory?

justint



 
Msg#: 4397533 posted 12:02 am on Dec 14, 2011 (gmt 0)

I have been working through the page and taking out includes and the stylesheet and closing some tags just to test. The page does use the contents of more than one directory but if I take out all the includes I still have the problem.

If I take out the stylesheet I don't have the problem though what I could have done to create this I am not sure as I never really change the stylesheet much.

What seems to be happening is that the stylesheet is ignored after a certain point, as if I stick some more stuff in the bottom that is ignored.

Having said that it is only text formatting that is ignored and not layout formatting.

g1smd

WebmasterWorld Senior Member g1smd us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4397533 posted 12:09 am on Dec 14, 2011 (gmt 0)

Firebug lets you see which bit of the CSS applies to each HTML element.

By inspection you should be able to find the break.

justint



 
Msg#: 4397533 posted 12:37 am on Dec 14, 2011 (gmt 0)

Yes thanks, been playing with firebug, yet to find the bug

Hoople

10+ Year Member



 
Msg#: 4397533 posted 1:07 am on Dec 14, 2011 (gmt 0)

Segment the page into multiple TEXT files leaving the ending /body and /html tags in place. Work through the first one fixing the validation issue. Then add them back one at a time and repeat. After 20+ years doing HTML I end up doing this once a year or so. It creates a real 'face-palm moment' when you find it too!

There are a number of online HTML validators (<--- good search term). Sometimes these validator error reports are decidedly UN helpful. Comparison validation checks may find the one little thing that causes tens of errors to be reported.

Oh....by the way....welcome to WebmasterWorld justint!

lucy24

WebmasterWorld Senior Member lucy24 us a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



 
Msg#: 4397533 posted 4:31 am on Dec 14, 2011 (gmt 0)

Oh wait, wait. You said the formatting dies.

Does your CSS list styles in the order they are used? (It shouldn't, for other reasons, but never mind that now.) If so, the problem may not be in your HTML at all. It may be in your CSS, most likely exactly what you said in your first post: "failed to close a tag". If the CSS contains an error such as an unclosed bracket, the rest of the CSS will be ignored but everything before the error will be read normally.

tedster

WebmasterWorld Senior Member tedster us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4397533 posted 4:42 am on Dec 14, 2011 (gmt 0)

W3C also has a CSS validator [jigsaw.w3.org] that might be a help.

justint



 
Msg#: 4397533 posted 9:50 am on Dec 14, 2011 (gmt 0)

I tried the CSS validator and it did sort one error which was a missing ; but still the main problem is there.

rocknbil

WebmasterWorld Senior Member rocknbil us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4397533 posted 5:08 pm on Dec 14, 2011 (gmt 0)

You said includes. Is this PHP? If so, you can try viewing the source of the code , copy and paste it into a test file, or copy and use the "Validate by direct input" tab at the Validator.

You might want to do that anyway. Start with the most basic framework, then add chunks until the errors appear. Correct them as you go, and keep adding them until they are all gone.

justint



 
Msg#: 4397533 posted 5:03 pm on Dec 18, 2011 (gmt 0)

I think I will start again from the ground up, the website needs an overhaul anyway! :)

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved