stevevan Posted May 15, 2005 Posted May 15, 2005 I'm trying to keep a site I'm designing within HTML 4.0 Transitional specs using the validation service at ht*p://validator.w3.org. I tried to validate a page that has the standard format: ><html> <head> ...some stuff... </head> <body> ...some more stuff... </body> </html> Running the code with the validation service, I received an error that says "end tag for element "HEAD" which is not open" meaning it can't locate the beginning <head> tag. Yet it IS there as I had the validation site display a source listing. To make matters even more weird, I had another page that was missing the beginning <html> tag and it validated just fine...even when I left off the ending </html> tag. Something doesn't seem right, so I wondering how worried should I be about this? Quote
nkycomputers Posted May 15, 2005 Posted May 15, 2005 I'm trying to keep a site I'm designing within HTML 4.0 Transitional specs using the validation service at ht*p://validator.w3.org. I tried to validate a page that has the standard format: <{POST_SNAPBACK}> This is very interesting as my site shows things like missing <p> openers when they are clearly right there. Some other weird things that are missing are there when you look at the code. Maybe I am missing something. Has anyone else used this and been valid? Quote
TCH-Dick Posted May 15, 2005 Posted May 15, 2005 Hey Steve if I'm looking at the right site, you have a table between and It looks like you are using php includes so just move that include inside of the . Quote
stevevan Posted May 15, 2005 Author Posted May 15, 2005 Figured it out. I had the following: ><link href="psra.css" rel="stylesheet" type="text/css"/> I removed the type to leave just this: ><link href="psra.css" rel="stylesheet"> and it now works fine. Don't really understand it (yet) but I'm researching so I can understand why. Quote
owatagal Posted May 15, 2005 Posted May 15, 2005 If you're using HTML 4.0, I don't think img, br, and link tags have closing slashes. The validator would then read the closing slash as the closing slash for the last legal open tag--in this case, the <head> tag. It doesn't recognize that you were mis-closing the link tag, just that the <head> tag is now closed. So when it sees the </head> tag, it wonders where the opening of that tag is. The validator is useful, but it follows a certain logic and that logic can send it down the wrong path. Once you removed the closing slash from the link tag, everything fell back into place. This sort of error is common for me when I validate--I can have a page with 50 errors on it that are all a result of a single missing or extra tag that causes the machine to mis-read the rest of the page. Fix the one tag, the other 50 "errors" (which weren't errors) disappear. The problem isn't that the code is wrong (except for the one error), it's that the validating machine reads patterns, and once it gets thrown off once, it tends to be thrown off for the rest of the page. It helps when working with the validator to realize that it has a pretty set-in-stone pattern recognition, and that once that pattern is broken the rest of the page will appear broken to the program, even though it's not. In my experience, fix the first error on the page and 90% of the rest of the errors disappear. Quote
stevevan Posted May 15, 2005 Author Posted May 15, 2005 Thanks for the info owatagal. I'm beginning to realize that. FWIW...I'm using HTML 4.01 Transitional. Also thanks to all the others. It's starting to sink in now! Quote
borfast Posted May 16, 2005 Posted May 16, 2005 Steve, some tags may not need to have a closing tag but if they do, it will still be valid HTML, so I suggest you close all the tags since it will make your life easier if later on you decide to move to XHTML - or simply because it's a good habit Quote
stevevan Posted May 16, 2005 Author Posted May 16, 2005 Good idea...that'll be in the next rewrite of the site! Quote
TCH-Dick Posted May 16, 2005 Posted May 16, 2005 Steve, some tags may not need to have a closing tag but if they do, it will still be valid HTML, so I suggest you close all the tags since it will make your life easier if later on you decide to move to XHTML - or simply because it's a good habit Just don't close or tags. These are the only two tags that I know of that will cause HTML(with XHTML syle closing tags) to fail validation Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.