Validate Your Markup
You can’t play fast and loose with the strict standards the way you could with old HTML. Code written incorrectly may render strangely or not at all. While HTML was always meant to be validated, it is now more important than ever to validate your markup before you publish your content on the Web.
Some HTML editors, like BBEdit by BareBones Software, have built-in validators. You may also use the W3C’s free validation tools for HTML/XHTML (http://validator.w3.org) and CSS (http://jigsaw.w3.org/css-validator).
Be forewarned: the error reports a validator spits out can be overwhelming. One of the problems is that errors are inherited, so if you make a mistake early on (such as forgetting to close a tag) the validator gripes about it in multiple error lines. Try fixing early mistakes and then validating again; chances are, the error list will reduce.
Error messages can also be confusing. The W3C has published a list of common error messages and how to interpret them at http://validator.w3.org/docs/errors.html.