Re: Responsive design not showing responsive in email - outlook and gmail so far

Dave_Roberts
Level 10

Re: Responsive design not showing responsive in email - outlook and gmail so far

Thanks Dante-

I'll spin this up in Marketo and send it to Litmus to have a closer look, let me circle back on that piece.

In the short term, here's some "potential" feedback I noticed from a quick scan:

Here's a table I grabbed from the HTML:

<table class="table3-3" style="-webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; mso-table-lspace: 0pt; mso-table-rspace: 0pt; border-spacing: 0; border-collapse: collapse;" align="left" border="0" cellpadding="0" cellspacing="0" width="220">

I might be superstitious but I've had success with defining an "order" to the HTML where attributes precede the style="" tag - as a 'rule of thumb' I try to add the class="" after the other attributes and before the style attributes b/c it pretty much reads styles into the document at that point, so that will establish some sort of "logical order" -- standardizing this order on all elements has shored up inconsistent display issues before, but more over is a peace of mind thing for testing/dev/troubleshooting. This part is more "polish" than "substance" - so not "required" but "recommended" maybe. That said - for starters it might look like this: (recommend add'l code in bold / not sure you need the other stuff yet😞

<table width="220" cellpadding="0" cellspacing="0" border="0" align="left" class="table3-3" style="border-collapse:collapse; width:220px;">

Next, the width="220" is likely "sticking" with your gMail display and compliments a few more tables that have fixed widths to create a row in the layout. Since those widths are fixed, Gmail will try and take the 640px display and "shrink" it down like a smaller version of the desktop version. This is b/c the elements on the screen exceed the normal screen size. Keep things in-and-around 320px max-width for mobile and you'll probably have more success with that. That said, I'd offer up this as a solution (but again, I'll loop back after a dive on this with more info):

<table width="100%" cellpadding="0" cellspacing="0" border="0" align="left" class="OneThird" style="border-collapse:collapse; width:100%;">

in your <style> in the <head>, you'll want to add:

/* makes it full width up to 640px */

@media screen and (max-width: 640px) {

.OneThird {

width:100%;

    }

}

/* makes it ____px under 640px */

@media screen and (min-width:640px) {

.OneThird {

width: 220px;

max-width:220px;

    }

}

I've found that since gMail started taking media queries, it can be good to be explicit with them and have rules for above/below 640px to "double-down" on gMail's ability to read a style and render it as expected. Sometimes tinkering with these settings (moving things from the <style> element into a media query) has helped, but not sure I completely understand why - yet.

May need to tinker this (it's a "general solution") to fit your framework a little, but I'll get back on that and see if we can surface a few ways forward to iron this out.

Thanks for sharing your code, stay tuned!

-Dave

Dave_Roberts
Level 10

Re: Responsive design not showing responsive in email - outlook and gmail so far

Hey Dante Murphy!

Good news, I think I was able to get a solution in place for you here. Check out the Litmus Test Results for Android, gMail and Outlook.

>> Litmus

Here's what I think is going on there:

When you grab the edge of your screen and resize it, you can "simulate" a smaller screen or device, but usually email has really crude breakpoints (one for mobile/one for desktop). This leaves a bunch of pixels in limbo and some of the widths you get (between 480 and 640) when you resize your screen aren't really "in play" in terms of inbox screen size for mobile devices.

The solution:

That said, what I noticed was that somewhere between the desktop (640px+) breakpoint and the mobile (<480px) breakpoint the content was running off the right side of the screen. I used the inspector see what was going on there, and found the .table600 class on the wrapping tables. The CSS for that was set to 500px for "desktop" and 350px for "mobile". I was able to fix the issue by changing the .table600 CSS in both media queries (it's in there twice) to this instead:

    table.table600 {

          width: 90% !important;

    }

the fluid (%) width of this gets along much better with the mobile clients. I've found that thinking about email as "mobile-first" and then applying styles as you go up to desktop (generally speaking desktop clients are more 'capable') has worked the best for me.

Please let me know if this resolves the issue for you, of if you've got any questions here/ want help implementing testing this out?

High five!

-Dave

developer, Digital Pi