简体   繁体   中英

Is safe to put html style tag into body tags coding html emails?

I am coding a html email template. All my code is inline. There are media queries between <style> tag inside the <head> tag.

Can I put the <style> tag inside the <body> tag?
Would that work with all major email clients?

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/

It seems client dependent. Check out a similar answer here .

Some clients will support the use of styling in the body, but generally not in the head. Since there is really no way to incorporate css, it makes sense that this would be the case.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM