html - 显示/隐藏转发的 html 电子邮件的图像

标签 html css email email-client forwarding

我试图在转发时在 html 电子邮件上显示/隐藏图像(一个用于桌面,一个用于移动)。我使用的方法适用于大多数电子邮件客户端(Lotus 除外),但是,如果电子邮件被转发,两个图像都会显示。我知道最简单的解决方案是只使用一个图像,但如果有一个解决方案可以在转发时使用显示/隐藏,我想知道。 HTML:

 <table border="0" cellpadding="0" cellspacing="0" width="100%">
        <tr>
            <td style="display:block; outline:none; text-decoration:none; -ms- 
             interpolation-mode: bicubic;" class="hide">
              <a href="ops_link"> 
               <img border="0" width="100%" src="ops_desktop_pic" alt="#" 
               class="hide" > 
             </a>
            </td>
            <td style="display:none; font-size:0; line-height:0; mso-hide: 
            all;max-height: 0; max-width: 0; width:0; -ms-interpolation-mode: 
            bicubic;" class="show">
             <a href="ops_link">
              <img border="0" width="100%" height="357"  src="ops_mobile_pic" 
              alt="#" class="show">
             </a>
            </td>
           </tr>
    </table>

和CSS:

    @media (max-width: 650px){
     .hide {
    display:none!important;
    width:0px!important;
    height: 0px!important;
    overflow:hidden!important;
    line-height: 0px!important;
    font-size:0px!important;
}
    .show {
    display:block!important;
    max-height: none !important;
    max-width:100% !important;
    line-height: 1.5 !important;
    width:100%!important;
    height:auto!important;
    font-size: 100%;
    mso-hide: none;
}
}

最佳答案

不,据我所知,无法解释 a) 转发的电子邮件或 b) 某些版本的 OWA。此代码对原始消息非常有效,但您会遇到这些问题。

关于html - 显示/隐藏转发的 html 电子邮件的图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49746109/

相关文章:

php - 让回车键点击搜索按钮

php - 数据库中 HTML 的正确格式

html - 挖空文字效果背景根据文字位置消失?

php - 制作一个恒定的标题 - css 问题

html - HTML 中的 Interop.Outlook 消息显示为纯文本

php - 使用 gmail smtp 服务器时如何更改发件人地址

javascript - 更改 anchor 链接文本大小和颜色

html - 内嵌 block 框不适合它们的容器

javascript - 如何放置一个 div,由 bootstrap 的 Navbar 打开

java - 使用不同的邮件 api jar 降低 sendmail 性能 (javamail)