Doctype for html email

て烟熏妆下的殇ゞ 提交于 2019-12-22 10:58:12

问题


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">

回答1:


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




回答2:


This is what I use.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

I code emails daily and this came as the header that exact target (salesforce) provided us. Our company has sister brands and this what they all use as well so I'm assuming this is standard.



来源:https://stackoverflow.com/questions/34319889/doctype-for-html-email

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!