'Gmail font-size increase in HTML Email template

I have a problem with an html email template in Gmail. In all other rendered browsers/mail clients it's rendered good so far, but I discovered a problem on Gmail Android App (tested on Samsung Galaxy S9+).

As you can see in the image, the big title beside the image is cut due to overflow - and I have no solution on how to prevent this. As said before, this happens on no other (mobile) mail client so far.

Found on Stack and other resources, that Gmail App can increase font-size - tried out following tipps I've seen so far, all without any positive effect:

  • !important directly on <td> and/or <a> with .listing-title
  • font-size in pt instead of px (with and without !important)
  • spacer.gif as top row (creates huge empty space on left side)
  • white-space: nowrap; can't be used because usually these titles are bigger than one line and this looks weird when cut off with overflow:hidden
  • special class with u + .gmail

Even if I change height of image and text-container - this then effects ALL mail clients of course...

Note: I'm not allowed to do big design changes, so it needs to be img on left side and these texts on right side.

Does anyone has further suggestions on how this cut off could be prevented? Thank you in advance!

  .ReadMsgBody {
          width: 100%;
        }
        .ExternalClass {
          width: 100%;
        }
        span.yshortcuts {
          color: #000;
          background-color: none;
          border: none;
        }
        span.yshortcuts:hover,
        span.yshortcuts:active,
        span.yshortcuts:focus {
          color: #000;
          background-color: none;
          border: none;
        }
        html,
        table {
          font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", arial;
        }
        .main-tbody * {
          margin: 0;
          padding: 0;
        }
        .padding {
          width: 50px;
        }
        .copyright {
          width: 500px;
        }
        .location-row {
          display: block !important;
        }
        .button-padding {
          display: none !important;
        }
        
        @media screen and (max-width:620px) {
          .location-row {
            display: none !important;
          }
          .main-table {
            width: 320px !important;
          }
          .inner-table {
            width: 320px !important;
          }
          .image-listing {
            width: 80px !important;
            height: 60px !important;
            max-width: 80px !important;
            max-height: 60px !important;
          }
          .image-container {
            width: 80px !important;
            height: 60px !important;
          }
          .listing-title {
            font-size: 14px !important;
            line-height: 18px !important;
            height: 35px !important;
          }
          .listing-price {
            font-size: 12px !important;
            height: 14px !important;
          }
          .button-padding {
            display: block !important;
          }
          .copyright {
            width: 320px !important;
          }
        }
        
        a[x-apple-data-detectors],
        .x-gmail-data-detectors,
        .x-gmail-data-detectors *,
        .aBn,
        u+#body a,
        #MessageViewBody a {
          color: inherit;
          text-decoration: none;
          font-size: inherit;
          font-family: inherit;
          font-weight: inherit;
          line-height: inherit;
        }
 <body id="body" style="font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Ubuntu, 'Helvetica Neue', sans-serif; margin:0; min-width:320px;">
      <table class="main-table" border="0" cellpadding="0" cellspacing="0" align="center" style="text-align: center; background: #f5f5f5; margin-inline-start: auto; margin-inline-end: auto;" width="600">
        <tbody class="main-tbody">
          <!-- Header -->
          <tr align="center" style="margin: 0 auto; text-align: center;">
            <td colspan="3">
              <table class="inner-table" border="0" cellpadding="0" cellspacing="0" align="center" width="500" style="margin: 0 auto; text-align: center;">
                <tbody align="center">
                  <tr>
                    <td colspan="3" height="40" style="height: 40px;">
                      <p style="margin: 0;"></p>
                    </td>
                  </tr>
                  <tr style="height: 40px; width: 100%;" align="center">
                    <td colspan="3" class="desktop-logo" width="500">
                      <img height="48" width="128" style="display: inline-block; vertical-align: middle" alt="Logo" src="https://via.placeholder.com/128x48.png?text=logo">
                    </td>
                  </tr>
                  <tr>
                    <td colspan="3" height="30" style="height: 30px;">
                      <p style="margin: 0;"></p>
                    </td>
                  </tr>
                </tbody>
              </table>
            </td>
          </tr>
          <!-- Header -->
          <tr>
            <td class="padding" width="50"></td>
            <td>
             
              <!-- Listing -->
              <table class="inner-table" border="0" cellpadding="0" cellspacing="0" align="center" style="background-color: #ffffff;" width="500">
                <tbody>
                <tr class="list-container" style="width: 100%; max-height:140px;">
                  <td width="10"></td>
                  <td class="image-container" colspan="1" width="160" height="140" style="max-height:140px;">
                    <a href="">
                      <img class="image-listing" src="https://via.placeholder.com/160x120.jpeg?text=image" alt="" style="display: block; width: 100%; height: 100%; max-height: 120px;max-width: 100%; object-fit: cover" width="160" height="120">
                    </a>
                  </td>
                  <td width="10"></td>
                  <td class="text-container" colspan="2">
                    <table border="0" cellpadding="0" cellspacing="0" align="left" width="100%" style="width: 100%;">
                      <tbody>
                      <tr>
                        <td class="padding-top-inner-table" height="10" style="height: 10px;">
                          <p style="margin: 0;"></p>
                        </td>
                      </tr>
                      <tr>
                        <td>
                          <a href="" style="width: 500px">
                            <table border="0" cellpadding="0" cellspacing="0" align="left" width="500" style="width: 100%; text-align: left; color: #212338;">
                              <tbody>
                              <tr class="location-row">
                                <td style="width:100%; font-size: 12px; font-weight: 400;display: block; height:16px;" height="16">
                                  <a href="" style="overflow: hidden;  width:100%;height: 16px; margin: 0;text-decoration: none;color: #232f3f; display: block">
                                    A small title
                                  </a>
                                </td>
                              </tr>
                              <tr>
                                <td class="location-row" height="10" style="height: 10px;">
                                  <p style="margin: 0;"></p>
                                </td>
                              </tr>
                              <tr>
                                <td class="listing-title" style="font-size: 16px; height:42px; font-weight: 400;display: block" height="42">
                                  <a class="listing-title" href="" style="overflow: hidden; height: 42px; margin: 0;color: #232f3f;display: block; text-decoration: none; font-weight:bold; font-size: 16px;">
                                    The very main big title which makes problems
                                  </a>
                                </td>
                              </tr>
                              <tr class="location-row" height="27" style="height: 27px;">
                                <p style="margin: 0;"></p>
                              </tr>
                              <tr height="8" style="height: 8px;">
                                <p style="margin: 0;"></p>
                              </tr>
                              <tr height="19" style="height: 19px;">
                                <td class="listing-price" height="18" style="height:18px; margin: 0;font-weight: normal; font-size:14px; text-align: left; text-decoration: none;">
                                     Tag 1 |    Tag 2    | € price  
                                </td>
                              </tr>
                              </tbody>
                            </table>
                          </a>
                        </td>
                        <td width="15" style="width: 15px;">
                          <p style="margin: 0;"></p>
                        </td>
                      </tr>
                      <tr>
                        <td colspan="3" height="8" style="height: 8px;">
                          <p style="margin: 0;"></p>
                        </td>
                      </tr>
                      </tbody>
                    </table>
                  </td>
                </tr>
                <tr>
                  <td colspan="5" height="10" style="height: 10px; background: #f5f5f5;">
                    <p style="margin: 0;"></p>
                  </td>
                </tr>
                </tbody>
              </table>

              <!-- Listing -->

            </td>
            <td class="padding"></td>
          </tr>

        </tbody>
      </table> 


Solution 1:[1]

I can't seem to reproduce the problem on your screenshot in Gmail on Android. My guess is there's something else in your code conflicting with Gmail's rendering. One thing I see is that there are missing <td>s here and there in your code. For example here:

<tr class="location-row" height="27" style="height: 27px;">
    <p style="margin: 0;"></p>
</tr>

This should be:

<tr class="location-row" height="27" style="height: 27px;">
    <td><p style="margin: 0;"></p></td>
</tr>

There are also two <body> elements in your code.

As a general rule for Gmail troubleshooting, I would:

  • Make sure your <style> tags are inside the <head> of your email. Gmail doesn't support <style> in the <body>.
  • Make sure your email can render correctly with and without <style> tags. Gmail mobile webmail and Gmail Apps with Non Gmail Accounts don't support <style> tags.
  • Make sure your HTML overall weight is not bigger than 102 Kb. Gmail clips email at 102 Kb and limits <style> to 16 Kb.
  • Use a neutral service that doesn't alter your HTML to send your tests (like Putsmail or Parcel).

Here’s an old post I wrote about troubleshooting Gmail’s responsive design support .

If this still doesn't help, feel free to share the entire code that you sent to trigger that bug in the first place.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 HTeuMeuLeu