Which DOCTYPE is the right one for HTML email?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
The doctype is important because it helps us see those easily digestible pages. If a user doesn't enter a doctype during the creation of the HTML email or web page, then there is no guarantee that it will open up for your subscribers as intended.
A doctype declaration tells the browser that the page to be rendered is written in HTML. To declare an HTML5 doctype, `<! DOCTYPE html>` is required in the first line of your HTML document. Doctype declaration for HTML5 is not case sensitive and does not require a closing tag.
There is only minor differences these days in DOCTYPE declarations in html email. Although only minor, it is still recommended to test your emails via Email on Acid or Litmus or any other testing software prior to a send to ensure cross client compatibility and to find any unforeseen quirks.
The larger issues comes with if you do not declare a doctype or body tag, it can really screw up different parts of the email on certain clients.
The most popular DOCTYPE nowadays is the HTML 5 doctype (<!DOCTYPE HTML>
) which is used with very little hiccups. The most popular/safest doctype used to be the <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
doctype. This can still be used, but may limit different capabilities of your email, as it is referencing an older version of HTML.
See this forum post in litmus for more in-depth information on this: https://litmus.com/community/discussions/39-explanation-of-doctype-html-attributes-and-meta-tags-in-email-head
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With