Our RSS Feeds

Prevent Yahoo! Mail from displaying the mobile version of your email

Soon after publishing our recent post on ‘Mobile email design in practice’, it was pointed out to us that using @media queries to optimize email for mobile devices has a glaring downside. As it turns out, Yahoo! Mail inexplicably gives precedence to the @media stylesheet, using the CSS styles defined within, over any inline styles in the HTML email. The result is predictably sub-optimal:

Thankfully, there’s a straightforward, if less-than-elegant solution. It turns out that Yahoo! Mail ignores any styles that use attribute selectors, meaning that you can use these in your @media queries to ensure that Yahoo! Mail doesn’t override existing inline styles with your @media -defined ones. For example, you would change:

The result for us was a restored-width email newsletter in Yahoo! Mail that displays consistently across the most popular webmail and desktop email clients.

Thankfully, this solution doesn’t affect the display of mobile-optimized email in the iPhone and Android’s respective Mail email clients. However, it does bung up how emails render in Yahoo! Mail’s mobile browser client… If that’s a concern to you.

Of course, the danger is that Yahoo! Mail will someday support attribute selectors and render this technique useless. So keep testing and hope that they properly implement @media queries well before then.

Many thanks to mobile email design legends Ed Melly and Stefan Velthuys for outlining this excellent mobile optimization for our monthly newsletter. We hope this helps you get your HTML emails close to pixel-perfect in both desktop and mobile email clients alike.

9 Comments

Great stuff! Thanks for the writeup, Ros. I’d add that depending on the specific alterations you’re performing with @media, making the stylesheet external can help, as well.

Ed Melly
28th April

@Chris - the problem with using an external stylesheet is that it’ll only be downloaded when the recipient chooses to view images (otherwise it could be used as a form of open tracking).

Where the external stylesheet amends the layout, you see a jump between the desktop and mobile-optimised versions, which can be a bit jarring (at least in the native Android client, where images aren’t enabled by default).

And send out two versions of your campaign, one with the @media styles and the other with out.

andipandi
29th June

Thank you, I was wondering what was up with that. Also, any tricks on getting rid of the links they spam your emails with? I’ve got .yshortcuts rewritten, but the <a> link is outside of that and always returns an underline. I want the links I’ve created to have an underline, not these impostors.