2

<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 上,图像未正确缩放。见附图。在此处输入图像描述 有谁知道如何解决它?谢谢!

4

2 回答 2

3

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

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

于 2017-12-05T23:08:53.003 回答
0

您给表格的宽度和高度与其中的 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>

希望这对你有用

于 2017-12-06T03:20:14.497 回答