电子邮件开发人员:如何仅在移动客户端中显示td /图像?

时间:2018-11-22 16:30:34

标签: email html-email

我希望仅在移动浏览器中打开电子邮件时显示图像/(或td)。 到目前为止,这是我已经实现的方法,并且在Gmail中不起作用:

.resetimage {
          display: block !important;
  max-height: inherit !important; 
   width: auto !important; 
      }

<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
       <td style="padding:0px 0px 30px 0px;" width="100%">
        <img class="resetimage" data-assetid="34095" height="132" src="imageurl.jpg" style="display:none; max-height:0; width:0;">
        </td>
        </tr>
        </table>

是否只能在移动设备上为Gmail呈现?

2 个答案:

答案 0 :(得分:0)

可能是因为您发布的类是.displaymobile,但是img元素具有类.resetimage

答案 1 :(得分:0)

这对使用@media查询的任何电子邮件客户端都有效:

<style>
.showmobile {
  display: none !important;
}
    @media screen and (max-width: 600px) {
    .showmobile {
        display: block !important;
        width: auto !important;
        overflow: visible !important;
        float: none !important;
        max-height: inherit !important;
        line-height: inherit !important;        
    }
}
</style>

体内:

<table class="showmobile" style="display: none; mso-hide: all;">
  <tr>
    <td align="center" class="showmobile" style="display: none; mso-hide: all;">
    Hello mobile
    </td>
  </tr>
</table>

这有助于从Outlook隐藏仅移动设备的内容。

这不适用于Android 6电子邮件,Android 4.4,Outlook for IOS(其他问题)。

祝你好运。