Why does Gmail block CSS in emails?

I used CSS in my letter and posted it.

When I received an email in Gmail, all CSS was disabled; however, when I received the email in thunderbird or Outlook, everything is fine.

How can i fix this?

+53
css html-email gmail
12 Oct '09 at 15:17
source share
8 answers

Gmail does not completely block CSS. It still supports inline style. Why it does not support the style block, I have no idea. To have a good overview of CSS support in various email and mail clients, here is a good one. http://www.campaignmonitor.com/css/

+70
Oct 12 '09 at 15:20
source share

Style sheets are one of many HTML features that are often blocked by webmail providers.

HTML mail is a world of pain , and it will not improve - in fact, you can expect to get worse from it. Almost every HTML feature is not supported in some email or webmail services. Anything modern is dead loss. And of course, there are still only text clients.

If you don’t have endless free time to burn guessing code and testing every last mail server, forget HTML mail . Just send a text letter with a link to a regular web page where you can be sure that everything will work as expected.

+23
Oct 12 '09 at 15:59
source share

I answer it too late, but it might help someone here. To be able to view mail as it is in gmail and other email clients, you need a built-in style for each tag in your html, but it takes a lot of time to write in-line css for each html tag to save your time using the built-in tool

http://templates.mailchimp.com/resources/inline-css/ 

Just insert the whole email template and you will get an html document with embedded css in each tag. It is very simple :)

Note. You can have your class and identifier in the class as is.

+23
Nov 04 '15 at 8:33
source share

If you could embed styles in classes and identifiers in an email, this might inadvertently come across styles used by gmail to display the application, or specifically for someone with malicious intent. Inline styles are local to the tag and therefore leave only gmail styles.

Google must protect a user interface designed for people.

+18
Oct 12 '09 at 15:24
source share

Another good source of information is the MailChimp EMail Template Reference . I find the Development section to be especially useful as it contains information on what CSS GMail supports and how to use it.

+6
Sep 13 '13 at 13:51 on
source share

I just tested this and it supports inline styles, makes the code a little ugly, but you can get around it all.

Hope this helps.

+3
Jan 07 '14 at
source share

If you use Ruby on Rails and ActionMailer, you can use the ActionMailer Inline CSS gem. All you have to do is install the gem and it will automatically inject all the CSS into your email templates. It literally could not be easier.

ActionMailer Inline CSS on GitHub

0
Jun 29 '16 at 21:26
source share

Gmail blocks all external (specified) assets - style sheets, images, scripts, etc. This protects the privacy of the recipient. You can still include inline styles:

 <span style="color:red;">Red text</span> 
-one
Oct 12 '09 at 15:23
source share



All Articles