Paolo Pascua
Paolo Pascua

Reputation: 123

PHP emails with CSS not working on gmail

I already read lots of threads about this and they all say that gmail doesnt support the style tag so I have to use the inline styling to resolve the problem. The problem is that I've look at the source code on most of the emails that I've received on gmail and most of them use the css style tag, which contradicts what other says.

So question is, why the emails with css that I've send via php mail is not showing correctly on gmail. It does show ok on Yahoo and Hotmail though

Upvotes: 0

Views: 3642

Answers (2)

John
John

Reputation: 12193

Many people design with their CSS in the style tag and then use a tool to inline it prior to sending, making it compatible with for Gmail. Depending on the tool, it may not remove the original css, effectively doubling up. Another reason could be that those css declarations are intended for non-Gmail clients. A common example is media queries, which don't work inline, making them incompatible with Gmail.

Here is a related blog post I've written that also includes a few links to some popular CSS inlining tools

Upvotes: 1

Jon P
Jon P

Reputation: 19772

Its a bit hard to provide a detailed answer to a question that doesn't provide specifics so I'll make some general comments...

Cross web-browser designing is a piece of cake compared to designing HTML emails for different e-mail clients. There are far more email clients than web-browsers and far more variation in their support of HTML and CSS rendering. There are no "standards" per-se.

You need to keep everything simple and play to the lowest common element. It's not just a matter of the style tag being implemented or not, different client may or may not support different styles. You need to experiment with what works and what doesn't on as many clients as possible.

Some more reading for you if you haven't read these already:

Upvotes: 1

Related Questions