This morning, I got an e-mail from one of our readers saying that she’d entered the text from one of our examples exactly as it appeared in the book, but that the page didn’t look or behave at all correctly. As I do whenever I get such an e-mail from a reader I replied with “Please send me the file so I can look it over.” Shortly thereafter I plucked it from my inbox and gave it the hairy eyeball.
I did see a few obvious mistakes (use of single quote ‘ character where a double quote ” was needed to supply attribute values. mostly), and then I did next what any semi-serious HTML hacker should do when checking a page over for errors. I jumped over to validator.w3.org, clicked the “Validate by File Upload” tab, and pushed that file up to the validator to see what it could find.
Next, I used the browse tool built into the “Choose file” button to select the test file on my PC, and clicked the Check button to get a syntax report. BAM! A small and subtle error in the DOCTYPE declaration, an issue with the XML namespace declaration, and missing quotes around an anchor tag URL were all still invalid.
A couple of quick text tweaks, saves, and subsequent validation checks, and the next thing I saw was this:
It may seem simple-minded and persnickety to do this, but actually it’s simple, easy, and smart. There’s no better way to be sure that your markup is correct than to submit it for a formal syntax check. That’s probably why most of the good development tools (like DreamWeaver, for example) include built-in syntax checkers as part of the development process.
Please! Do yourself (and us) a favor: if you need to send us a file for a once-over, please clean it up as much as you can with the W3C Validator, or a similar tool, before you ship it our way. It may make it unnecessary for you to send it to us in the first place, and you can’t help but learn a thing or two along the way.
the same thing happened to me and I did what you said put it in the validator … it went through… but i can still not see it in my browser???