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?
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?
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?
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.
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!
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.