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.
Deprecated tags are still supported, and in some cases an email client may only support the older, deprecated element.
You may choose to encode the ampersand, but I usually don’t find that these cause problems.If your messaging platform or ESP uses specialty tags or proprietary scripting, these will also trigger validation warnings that appear as “Element x undefined.” For example, Campaign Monitor uses the tags to indicate where the unsubscribe link should appear in your email.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.There are several types of messages that are generally safe to ignore.
A common error you might see is “there is no attribute BACKGROUND.” While BACKGROUND is a perfectly valid element for using background images in an email (and the only way to ensure background images display in Gmail), it’s considered a “deprecated” element and thus invalid under certain specifications.
Chances are you’ll have to ignore these warnings in order for your email to work properly after it’s been sent from your provider.
Keep in mind that errors can cascade, meaning that one error at the beginning of your HTML may trigger more further down the document.
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.
An element is considered deprecated when it is slated for removal from the specification when new or better ways of doing the same thing are introduced.