3

The title is really just the shortened version of the question. I'm aware of Gmail's limited CSS support, but I was reading "Guide to CSS support in email", which has a note for Gmail's support of .class and #id selectors:

(!) Works in some instances if CSS is inlined before or during campaign import

What does this actually mean as far as CSS support is concerned? To me, it sounds like it's just suggesting to use a preprocessor to take any style declarations and apply them to the matched elements.

Is there a trick to being able to use CSS classes in an HTML email in the Gmail client?

2 Answers 2

10

Gmail will only use CSS that is inline. It will not allow internal or external style sheets. Or rather I have found its support to be unreliable at best. Use this tool to do to convert internal and external style into inline for you:

http://inlinestyler.torchboxapps.com/styler/

It even tells you how well your document is supported in different email clients. This will allow you to develop in a more sane fashion, and only convert it at the end.

2
  • Wow, that tool is fantastic! I have to code an email tonight and this will help tremendously. Bookmarked!
    – daGUY
    Commented Sep 12, 2012 at 15:27
  • @daGUY I know right? It's such a magnificent time saver. Props to the developers. Commented Sep 12, 2012 at 15:29
0

Gmail does support .class and #id selector and internal style sheets (meaning tags) at the moment. You should keep in mind that some of the styles are modified by Gmail. You can't for example use negative margins or box shadows atm.

I'm not sure about external style sheets though. I haven't tested those.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.