Web Hosting Talk







View Full Version : Invalid XHTML 1.0


stripeyteapot
09-05-2004, 02:00 PM
<!-------------------- START CSS PRELOAD IMAGES -------------------->
<img src="images/menu/bggn.gif" alt="MENU2" title="MENU2" class="pre" />
<img src="images/bg2.gif" alt="BG2" title="BG2" class="pre" />
<!-------------------- END CSS PRELOAD IMAGES -------------------->



What's wrong with that? When validating my page, I got 18 errors, all of which are in this piece of code.

The errors are;



1. Line 9, column 8: multiple comments in comment declaration

<!-------------------- START CSS PRELOAD IMAGES -------------------->


2. Line 9, column 12: multiple comments in comment declaration

<!-------------------- START CSS PRELOAD IMAGES -------------------->


3. Line 9, column 16: multiple comments in comment declaration

<!-------------------- START CSS PRELOAD IMAGES -------------------->


4. Line 9, column 20: multiple comments in comment declaration

<!-------------------- START CSS PRELOAD IMAGES -------------------->


5. Line 9, column 22: S separator in comment declaration

<!-------------------- START CSS PRELOAD IMAGES -------------------->


6. Line 9, column 23: invalid comment declaration: found name start character outside comment but inside comment declaration

<!-------------------- START CSS PRELOAD IMAGES -------------------->


7. Line 9, column 0: comment declaration started here

<!-------------------- START CSS PRELOAD IMAGES -------------------->


8. Line 9, column 24: character data is not allowed here

<!-------------------- START CSS PRELOAD IMAGES -------------------->

You have used character data somewhere it is not permitted to appear. Mistakes that can cause this error include putting text directly in the body of the document without wrapping it in a container element (such as a <p>aragraph</p>) or forgetting to quote an attribute value (where characters such as "%" and "/" are common, but cannot appear without surrounding quotes).


9. Line 10, column 71: document type does not allow element "img" here; assuming missing "object" start-tag

...n.gif" alt="menu2" title="menu2" class="pre" />


10. Line 12, column 8: multiple comments in comment declaration

<!-------------------- END CSS PRELOAD IMAGES -------------------->


11. Line 12, column 12: multiple comments in comment declaration

<!-------------------- END CSS PRELOAD IMAGES -------------------->


12. Line 12, column 16: multiple comments in comment declaration

<!-------------------- END CSS PRELOAD IMAGES -------------------->


13. Line 12, column 20: multiple comments in comment declaration

<!-------------------- END CSS PRELOAD IMAGES -------------------->


14. Line 12, column 22: S separator in comment declaration

<!-------------------- END CSS PRELOAD IMAGES -------------------->


15. Line 12, column 23: invalid comment declaration: found name start character outside comment but inside comment declaration

<!-------------------- END CSS PRELOAD IMAGES -------------------->


16. Line 12, column 0: comment declaration started here

<!-------------------- END CSS PRELOAD IMAGES -------------------->


17. Line 13, column 6: end tag for "object" omitted, but OMITTAG NO was specified

</head>

You may have neglected to close a tag, or perhaps you meant to "self-close" a tag; that is, ending it with "/>" instead of ">".


18. Line 10, column 0: start tag was here

<img src="images/menu/bggn.gif" alt="menu2" title="menu2" class="pre" />



I'm not sure what they mean, because I can't see the errors (Maybe because I'm tired?). Any help is appreciated.

Arcane
09-05-2004, 03:09 PM
Remove the extra hyphens from your comma.
Replace each one with a simple <!-- -->

That should solve the problem.

the_pm
09-05-2004, 03:46 PM
Correct Arcane. Here's a link to more detailed explanation. http://www.htmlhelp.com/faq/html/basics.html#html-comments

stripeyteapot
09-05-2004, 03:47 PM
I'll try that, didn't think it effected it, also for 17 / 18?

Note: There is a start head tag.

the_pm
09-05-2004, 03:54 PM
Hmm...can't tell without seeing more of the code. Usually errors like this are the result of forgetting to close a previous tag, or forgetting a quote or something trivial like that. Can you post a URL?

stripeyteapot
09-05-2004, 04:02 PM
Paul, I would rather not, however it's the same URL I PM'd you a few days ago :) It should be in your inbox still.

the_pm
09-05-2004, 04:46 PM
Ok, error #17 follows the series of errors before it, so there may be something within those comment tags that's triggering continued errors. Do you need them there? Personally, I've never seen preloading done by placing <img> tags in a page's head, and I'm not convinced this is legit - I'll have to check this out.

Try fixing or removing the comments and then see where you stand :)

stripeyteapot
09-05-2004, 09:14 PM
I only placed them in the head to keep my code a little neater, I can always move them if it causes any problems in my testing phase. Also, you'll notice I'm using a "pre" class which has display: none; set in the CSS, so those images load with the page, therefore no waiting when the hover comes :)

I'll see if changing them round and removing the comment tags etc. work once I get the time.

Thanks!