my whole website validated in XHTML and CSS, and then I added in the final code from statcounter, checked for a last time and counted about 8 errors.
the offending code is:
<!-- Start of StatCounter Code --> <script type="text/javascript" language="javascript"> <!-- var sc_project=324426; var sc_invisible=1; var sc_partition=1; var sc_security=""; //--> </script>
<script type="text/javascript" language="javascript" src="http://www.statcounter.com/counter/counter.js"></script><noscript><a href="http://www.statcounter.com/" target="_blank"><img src="http://c2.statcounter.com/counter.php?sc_project=324426&java=0&security=&invisible=1" alt="hit counter code" border="0"></a> </noscript> <!-- End of StatCounter Code -->
Error Line 154 column 302: end tag for "img" omitted, but OMITTAG NO was specified. ...alt="hit counter code" border="0"></a> </noscript>You may have neglected to close an element, or perhaps you meant to "self-close" an element, that is, ending it with "/>" instead of ">".
There isn't really any need for the noscript section though. -shrugs- Up to you.
Statcounter uses a remote image call which passes some variables in that noscript section to track visitors with JS disabled. You can cut it if you want, but those users with JS disabled (both of them) won't get tracked.
it would be useful to track all visitors since the website is for a small business and it's good to know which pages are most frequently visited. The problem is though that leaving in the no script causes the invalidation - for the reasons above. Any workarounds would be gratefully recieved.
Thanks a lot Nifkin. It worked. My website is now validated 100%.
I do have one last question though. It's about max-width. My website is liquid and above 1024x768 it stretches too wide in IE. The code I was using is:
width: 93%; /* maximum width */ max-width:950px; /* IE Dynamic Expression to set the width */ width:expression(document.body.clientWidth > 950 ? "950px" : "auto" );
although the code worked for IE, it didn't validate so I Ieft it out.
It's not a huge problem as people with large screens can always resize their browsers but I was just wondering if you knew of a valid way to do this?
In the head of the document: <!--[if lte IE6]> <style type="text/css"> #content { width:expression(document.body.clientWidth > 950 ? "950px" : "auto" ); } </style> <![endif]--> Or alternatively you can use conditional comment to link to an IE only stylesheet and put the rule in that. Be sure to position it after the main stylesheet though so it cascades properly : )