0

I'm using negative margin values for an HTML email, which is admittedly a tricky issue. However, most of my email list is on OSX or iOS, so it's worth it. On the other hand, some of my list is on Gmail, where negative margin values get stripped. Instead of using a negative margin for my Gmail audience, I'm wanting to center that element instead. Is there a way to write CSS specifically for Gmail (or any other platform)?

Example code for Apple products:

.cmt_new img {margin-bottom: -55px; position:relative; z-index:1;}

enter image description here

Desired outcome for Gmail:

enter image description here

Community
  • 1
  • 1
Ian
  • 45
  • 8
  • You want to add code which only takes affect on Gmail? –  Nov 14 '15 at 20:21
  • @DaniSpringer Correct. Because Gmail is failing to do my plan A (top image), I'd like a satisfactory fallback (bottom image). – Ian Nov 16 '15 at 15:33

1 Answers1

0

One thing I can suggest, is to write a code that:
Works for the first email client (the not gmail one), and would look good, if you were to take out the piece that's not supported by gmail.
Basically you'd make a unique document work for both.
How?
By finding out exactly which codes Gmail doesn't support, you will be able to make a design, with in mind the fact that certain codes won't count.

Something like:

A = is a code that's supported by all (including gmail).
B = is a code that's not supported by gmail.

Code:

< A >Hello< A > < B > everyone < B >
< A > and welcome < A >

Result on emails: Hello everyone and welcome.
Result on gmail: Hello and welcome.

Get it?

  • That's a good fallback, and the route that I eventually took. The only problem is that A is also read by Gmail. It's hard to get a good look in Gmail without being able to write code only read by Gmail, but this might not be truly doable… – Ian Dec 03 '15 at 16:26
  • The problem is that Gmail is able to read the code that aligns the image on the left, but can't read the code that does the negative margin. The ideal fallback would be to center the image, but any type of centering method that Gmail can read is also readable by other programs. – Ian Dec 04 '15 at 20:04
  • What does the negative margin do usually? –  Dec 04 '15 at 20:05
  • And would you be OK with both versions having the image centered? –  Dec 04 '15 at 20:06