我正在编写一个HTML电子邮件模板。我的所有代码都是内联的。 <style>
标记内的<head>
标记之间存在媒体查询。
我可以将<style>
标记放在<body>
标记内吗?
这适用于所有主要的电子邮件客户端吗?
答案 0 :(得分:3)
Style tag inside the body has almost identical compatability to a style tag in the head. Each client offers different quirks with this, so overall I would recommend using style in head unless you are unable to.
For example Gmail will strip the style tag regardless where you put it. Your best bet is to test continuously using a service like Litmus or Email on Acid.
Good reference for CSS compatability in email is https://www.campaignmonitor.com/css/
答案 1 :(得分:1)
似乎客户依赖。查看类似的答案here。
有些客户会支持在体内使用造型,但一般不支持在头部。由于实际上没有办法合并css,因此情况就是这样。