CSS class to target only Gmail App for Android

I know this is a bit of an ask, but wondering if anyone has cracked this.

I want to be able to target CSS on the gmail app for android ONLY. I know on the browser version of gmail, it adds a class "ii" to the content, so it's fairly easy to target gmail only using that class.

However, does anyone know of any CSS classes that get built into the gmail app for android only?

This is for some responsive emails I'm building and I'm "winning" on all accounts, except for this little thing where I'd like to be able to target gmail app for android only. But I'm thinking this is going to be a bit of a stretch!

Cheers :)

JohnP JohnP, 2 years ago

jainaj, could you please share any more info you have on the 'ii' class. How do you target it, working around the issue of the style tags being stripped by Gmail. Thanks.

jainaj jainaj, 2 years ago

Hi JohnP - the "ii" class I was talking about was something I've spotted on emails coming in on my gmail account. All elements have the class, it's got this definition:

.ii {
direction: ltr;

I guess, if you wanted to target gmail you could assign whatever you want targeted a generic class name, say "gmail" and then when you state the class include "ii" in your statement.

Maybe something like that would work?

JohnP JohnP, 2 years ago

That is the part that seems straight forward to me. How to target it without a style tag is the challenge. Gmail is the main reason everyone inlines their CSS, so I was hoping you found some magic workaround for this limitation.

jainaj jainaj, 2 years ago

Ahh, I see! Glossed over that bit, didn't I?

What are you trying to do in the email when it comes to gmail?

JohnP JohnP, 2 years ago

Nothing specific. I was just wondering if you knew something I didn't... :)

matthewfelgate, 2 years ago

Would love a solution to the original question.  Anyway to target Gmail app..? Also any way to target the default mail clients on iOS and Android..?  Perhaps this could be done with CSS media queries for mobiles...

Tomnew, 2 years ago

Unfortunatelly gmail will strip out @media queries, so you can forget about them. Some time ago I've searched for some kind of solution for this, but no luck.

Best wishes pneumatig

Join 200,000 companies around the world that use Campaign Monitor to run email marketing campaigns that deliver results for their business.

Get started for free