2016-05-13 43 views
1

业余爱好者在编码时尤其如此,特别是涉及到电子邮件模板时。我很难让G-mail真正隐藏和正确显示内容。我在这里搜索并找到了一些我认为会有所帮助的答案,但它似乎不适合我的代码。截至目前,转发时不担心代码。用于隐藏和显示图像和文本的电子邮件模板

这里是具体的图像的代码部分。会爱上它的一些眼睛,也有一些帮助。一切都在一张桌子上,并且在普通浏览器中运行正常......只是专门在G-mail中寻求帮助。

CSS:

@media only screen and (min-width: 480px) { 

    .mobilechart { 
    display: none !important; 
    } 
} 

@media only screen and (max-width: 480px) { 

    .desktopchart { 
    display: none !important; 
    } 

HTML:

<tr> 
    <td style="background-repeat:no-repeat;background-position:right;" > 
    <div class="desktopchart"> 
     <img src="https://cdn.maropost.com/pro/uploads/account_415/77640/TC-Email_Template_DESKTOPCHART.jpg" style="width:100%;margin-top:auto;margin-bottom:auto;margin-right:auto;margin-left:auto;" > 
    </div> 
    <div class="mobilechart"> 
     <img src="https://cdn.maropost.com/pro/uploads/account_415/77641/TC-Email_Template_MOBILECHART.jpg" style="width:100%;margin-top:auto;margin-bottom:auto;margin-right:auto;margin-left:auto;" > 
    </div> 
    </td> 
</tr> 
+1

可能重复的[通讯不能隐藏敏感内容在Gmail上,当我尝试转发电子邮件](http://stackoverflow.com/questions/37182935/newsletter-cant-hide-responsive-content- gmail-and-when-i-try-to-forward-the) – Shaggy

回答

1

转贴我的回答this question

这里的坏消息是,很抱歉,Gmail尚不支持媒体查询也不支持display,overflowvisibility属性。

查看Campaign Monitor's CSS Support Guide for Email Clients了解更多信息。

除了重写您的通讯是完全流畅的,而不是试图使其响应,恐怕没有真正的解决方案在这里。

+0

谢谢。我害怕那样......这伤害了我的心。 –