Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Doctype for html email

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">
like image 898
Sharmile Avatar asked Dec 16 '15 18:12

Sharmile


People also ask

Do HTML emails need a DOCTYPE?

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.

How do I set DOCTYPE to HTML?

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.


1 Answers

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

like image 117
Gortonington Avatar answered Oct 17 '22 01:10

Gortonington