Also, Campaign Monitor has written up a nice post about the use of DOCYTPE in email.Once you’ve run your HTML through the validator, you’ll receive a list of warning and errors.Errors are generally more critical than warnings, but sometimes errors can be ignored depending on context and usage.

javascript not validating w3c-19

They can let you know if there are any errors present that might cause display issues and give you some clues for debugging.

Validators do this by checking your code against a specification, or a set of rules for the language that your code was written in.

These specifications make up what is commonly referred to as “web standards.” The trouble is that most email clients don’t support web standards and instead only support a hodgepodge of HTML and CSS.

HTML validators work best for email when you use them to check for syntax errors, unclosed tags, or orphaned tags. HTML validation works by comparing your HTML to a set of standards or rules, called a DOCTYPE.

When attempting to validate HTML coded for email with a web validator, it’s pretty common to see errors and warnings that are confusing. DOCTYPE is a document type declaration, and is usually placed at the beginning of your HTML file to tell the validator which set of standards to check your HTML against: In the case of web development, it also tells the browser which rendering mode to use.

The problem with using DOCTYPE with email is that some clients strip out the DOCTYPE or apply their own.

If you don’t include a DOCTYPE in your HTML file, the W3C validator will use the HTML 4.01 Transitional Document Type. Generally speaking, I recommend using the HTML 4.01 Transitional or XHTML 1.0 Transitional when validating HTML for email.

Validating HTML for email can be tricky–read on for our how-to guide.

One of the most popular validators is the free one maintained by the W3C, or World Wide Web Consortium.

Litmus’ comprehensive spam checking service also uses the W3C validator and reports back the warnings that the validator returns: Since most email clients don’t follow web standards and there are no email-specific standards in place, this means that validating the HTML you’ve written specifically for email can be tricky business.

Due to these variances in HTML support for some email clients, you might find yourself using hacks, deprecated elements or unstandardized code to get your design rendering correctly.