【问题标题】:Android gmail can't scale background image correctlyAndroid gmail 无法正确缩放背景图片
【发布时间】:2018-05-19 17:20:46
【问题描述】:

<html>
  <head>
  </head>
  <body>
  <td>
    <table align="center" background="{{imgUrl}}" height="461" width="597">
      <tr>
        <td width="597" height="461">&nbsp;</td>
      </tr>
    </table>
  </body>
</html>

参见上面的代码。在 android 上,图像未正确缩放。见附图。 有谁知道如何解决它?谢谢!

【问题讨论】:

    标签: android gmail html-email apple-mail


    【解决方案1】:

    您为表格提供了与其中的 td 相同的宽度和高度。您应该能够使用媒体查询来控制表格高度。

    试试这个代码:

    <html>
      <head>
        <style type="text/css">
         @media only screen and (max-width:480px) {
         .bannerTable{width:100% !important;height:auto !important;}
         }
        </style>
      </head>
      <body>
      <td>
        <table align="center" background="{{imgUrl}}" width="597" style="width:100%; max-width:597px; height:461px;display:block;" class="bannerTable">
          <tr>
            <td>Content goes here</td>
          </tr>
        </table>
      </body>
    </html>
    

    希望这对你有用

    【讨论】:

      【解决方案2】:

      这是由 gmail 自动调整大小引起的,可以通过应用 min-width 来修复 -- style="min-width:597px;"

      来自-https://www.campaignmonitor.com/forums/topic/7733/android-gmail-image-resizing-issues/的想法

      【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-09-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-07-28
      • 1970-01-01
      • 2012-07-13
      • 1970-01-01
      相关资源
      最近更新 更多