views:

320

answers:

4

I used css in my email and send out. when I received the email in gmail, all the css are disabled, but when i retrieve the email in thunderbird or outlook, everything is OK. Anyone has good idea ? Thanks in advance !

+4  A: 

Gmail doesn't block CSS totally. It still supports inline style. Why doesnt it support style block, I've no idea. To have a good overview of CSS support in various webmail and email clients, here's a good one. http://www.campaignmonitor.com/css/

o.k.w
A: 

Gmail blocks all external (referenced) assets - stylesheets, images, scripts, etc. This is to protect the privacy of the recipient. You can still include inline styles:

<span style="color:red;">Red text</span>
Rex M
Frankly, I do not see why eliminating < style > block entirely will protect the privacy. I agree for referenced stylesheets/scripts/images.
o.k.w
+4  A: 

If you could embed styles to classes and ids in an email, those could accidentally collide with styles used by gmail to display the application, or on purpose by someone with malicious intentions. In-line styles are local to the tag, and therefor leave gmail styles alone.

Google has to protect the user experience that it has created for people.

NerdFury
All/most other webmail providers allow style block. Doesn't see their own UI got 'hacked' by ill-intent CSSes.
o.k.w
+2  A: 

Stylesheets are one of many, many HTML features that are often blocked by webmail providers.

HTML mail is a world of hurt and it's not going to get any better — in fact, you can expect it to get worse. Almost every feature of HTML is not supported in some mailer or webmail service. Anything at all modern is a dead loss. And of course there are still the text-only clients.

Unless you have endless spare time to burn uglying up your code and testing every last mailer, forget HTML mail. Just send a text mail with a link to a normal web page where you can be sure everything will work as expected.

bobince
Services like http://www.campaignmonitor.com/ do the dirty work of "uglying up your code" quite well, speaking from experience.
Tomalak