Gmail mobile responsiveness issue for custom email layout

I’m having trouble with my email design not being responsive on Gmail mobile apps. The layout works fine on Outlook for both desktop and mobile but fails on Gmail. Here’s what I’m trying to do:

  1. Show images and text in a row on desktop
  2. Stack them vertically on mobile
  3. Change the background color on mobile

I’ve used media queries and CSS classes to achieve this. While it’s working well in Outlook, Gmail on both Android and iOS isn’t picking up the changes. Here’s a simplified version of my code:

<style>
  @media screen and (max-width: 480px) {
    .mobile-stack { display: block; width: 100%; }
    .mobile-bg { background-color: #E7E4DE; }
  }
</style>

<table class="mobile-bg" width="100%">
  <tr>
    <td class="mobile-stack">
      <img src="example.jpg" alt="Example Image">
      <p>Some text here</p>
    </td>
    <td class="mobile-stack">
      <img src="example2.jpg" alt="Example Image 2">
      <p>More text here</p>
    </td>
  </tr>
</table>

Any suggestions to help resolve this Gmail responsiveness issue?

I’ve faced similar issues with Gmail’s mobile responsiveness. From my experience, Gmail strips out tags and doesn’t support media queries, which explains why your layout isn’t adapting as expected.

A workaround I’ve found effective is using inline styles and Gmail-specific CSS classes. Try something like this:

<table width="100%" class="gmail-mobile-table-fix">
  <tr>
    <td style="display:inline-block; width:100%; max-width:300px;">
      <img src="example.jpg" alt="Example Image" style="width:100%;">
      <p>Some text here</p>
    </td>
    <td style="display:inline-block; width:100%; max-width:300px;">
      <img src="example2.jpg" alt="Example Image 2" style="width:100%;">
      <p>More text here</p>
    </td>
  </tr>
</table>

This approach uses Gmail’s supported CSS to create a responsive layout without relying on media queries. The ‘display:inline-block’ and ‘max-width’ properties help achieve the stacking effect on mobile. For background color changes, you might need to use conditional statements or fallback techniques specific to Gmail.

I’ve encountered this Gmail issue before, and it’s quite frustrating. Gmail’s lack of support for certain CSS features can be a real headache for email designers. One approach that’s worked well for me is using table-based layouts with conditional comments for Outlook. Here’s a basic structure:

This method allows you to create separate versions for Outlook and other clients, giving you more control over the layout in Gmail. Remember to test thoroughly across different devices and email clients to ensure consistency.

hey there, i’ve dealt with this headache too. gmail’s a pain with css. have u tried using ghost tables? they’re invisible to gmail but work for outlook. something like:

this might help with ur layout issues. good luck!