需要帮助修复响应式电子邮件中的 webkit 错误

如何解决需要帮助修复响应式电子邮件中的 webkit 错误

我的模板在 Litmus 的 gmail 版本中看起来响应迅速,但实际上不是,即使我使用属性选择器并且我的 webkit 修复在 div 标签上。我的 Outlook 2016 也发生了重大变化。我确定错误很小,但我找不到。谢谢。

这是我的身体标签:

CSS:

    @media only screen and (min-width:600px) {
    .mw35 {
      width: 35% !important;
    }
    .mw65 {
      width: 65% !important;
    }
  }
</style>

HTML:

    <!-- STORY 2 CONTENT -->
      <tr>
        <td><!--[if mso | IE]> <table role="presentation" border="0" cellpadding="0" cellspacing="0" width="600" align="center" style="width:600px;"> <tr> <td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;"> <![endif]-->
          
          <div style="margin:0px auto;max-width:600px;background:#FFFFFF;">
            <table role="presentation" cellpadding="0" cellspacing="0" style="font-size:0px;width:100%;background:#FFFFFF;" align="left" border="0">
              <tr>
                <td style="text-align:left;vertical-align:top;border:0px;direction:ltr;font-size:0px;padding:0px 40px; display: inline-block;"><!--[if mso | IE]> <table role="presentation" border="0" cellpadding="0" cellspacing="0"> <tr> <td style="vertical-align:top;width:35%;"> <![endif]-->
                  
                  <div class="mw35" style="vertical-align:top;display:inline-block;direction:ltr;font-size:13px;text-align:left;width:100%;">
                    <table role="presentation" cellpadding="0" cellspacing="0" style="border:0px;vertical-align:middle;" width="100%" border="0">
                      <tr>
                        <td style="word-wrap:break-word;font-size:0px;padding: 0px 15px 20px 0px;" align="left"><table role="presentation" cellpadding="0" cellspacing="0" style="border-collapse:collapse;border-spacing:0px;" align="left" border="0">
                            <tr>
                              <td><a href="#" target="_blank" style="color: #323232; text-decoration: underline;"><img alt="image 2" height="auto" src="https://dummyimage.com/154x121/ecf8fb/fff" style="border:0px;border-radius:0px;display:block;font-size:13px;outline:none;text-decoration:none;width:100%;height:auto;"  width="308"></a></td>
                            </tr>
                          </table></td>
                      </tr>
                    </table>
                  </div>
                  
                  <!--[if mso | IE]> </td><td style="vertical-align:top;width:65%;"> <![endif]-->
                  
                  <div class="mw65" style="vertical-align:top;display:inline-block;direction:ltr;font-size:16px;text-align:left;width:100%;">
                    <table role="presentation" cellpadding="0" cellspacing="0" style="border:0px;vertical-align:top;" width="100%" border="0">
                      <tr>
                        <td style="word-wrap:break-word;font-size:0px;padding:0px 0px 10px 0px;" align="center"><div style="cursor:auto;color:#F15B5D;font-family:'Open Sans',arial,sans-serif; text-align:left;"> <span style="margin: 0; font-family:arial,helvetica,sans-serif; color:#333333; font-size:22px; line-height:26px; font-weight:normal;"><b>LOREM IPSUM 2</b></span> </div></td>
                      </tr>
                      <tr>
                        <td style="word-wrap:break-word;font-size:0px;padding:0px 0px 10px 0px;" align="center"><div style="cursor:auto;color: #727272;font-family:sans-serif;font-size:16px;font-weight:normal;line-height:25.2px;text-align:left;">
                            <p style="margin: 0;">Lorem ipsum dolor sit amet,consectetuer adipiscing elit,sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p>
                          </div></td>
                      </tr>
                      <tr>
                        <td style="word-wrap:break-word;font-size:0px;padding:10px 0px 30px 0px;" align="center"><table role="presentation" cellpadding="0" cellspacing="0" style="border-collapse:separate;" align="left" border="0">
                            <tr>
                              <td style="border:1px solid rgba(230,236,238,1);border-radius:4px;color:#FFFFFF;cursor:auto;padding:10px 20px;" align="center" valign="middle" bgcolor="#FFFFFF"><a href="#" style="text-decoration: none; background: #FFFFFF; color: #333333; font-family: sans-serif; font-size: 16px; font-weight: 400; line-height: 120%; text-transform: none; margin: 0px;" target="_blank"><span>CTA</span></a></td>
                            </tr>
                          </table></td>
                      </tr>
                    </table>
                  </div>
                  
                  <!--[if mso | IE]> </td></tr></table> <![endif]--></td>
              </tr>
            </table>
          </div></td>
      </tr>
     

以下是它如何正确放置与整个身体移动的屏幕截图。此外,正确显示的响应式修复。

正确显示

correct display

转移

shifted

响应式显示

responsive display

解决方法

关于 Gmail,我猜您可能正在使用带有非 Gmail 帐户(例如 Outlook.com 电子邮件地址)的移动 Gmail 应用程序(iOS 或 Android)。这种特殊情况通常称为 GAGA(用于具有非 Gmail 帐户的 Gmail 应用程序),不支持 <style> 标签,因此不支持媒体查询 (as reported on Can I email)。为了让您的电子邮件在 GAGA 中正常工作,您必须使用流畅/混合或移动优先的方法对其进行编码,这样即使没有媒体查询,布局也能正常工作。

至于 Outlook,我不确定您指的是什么重大转变。我看到的一件事是,您的代码尚未准备好以 120 dpi 呈现的 Outlook,这可能是您的问题的一部分。 As documented here,要在 Outlook 中以 120dpi 获得良好的渲染效果,您需要:

  1. 在您的 xmlns:o="urn:schemas-microsoft-com:office:office" 标签中添加 <html> 命名空间。
  2. 在您的 <!--[if mso]><xml><o:OfficeDocumentSettings><o:PixelsPerInch>96</o:PixelsPerInch></o:OfficeDocumentSettings></xml><![endif]--> 中添加 <head> 声明。
  3. 在 CSS 中使用 width 属性而不是 HTML 中的 width 属性。
  4. 对具有 Outlook 所需宽度的图像元素使用 width 属性。 (此处您的图像设置为 width="308",而它在桌面版 Outlook 中仅应显示为 154 像素。因此应改为 width="154")。

这是我调整和测试的完整电子邮件代码。

<!DOCTYPE html>
<html lang="en" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <title>Need help for webkit bug fix in responsive email</title>
    <style>
        @media only screen and (min-width:600px) {
            .mw35 {
                width: 35% !important;
            }
            .mw65 {
                width: 65% !important;
            }
        }
    </style>
    <!--[if mso]>
    <xml>
    <o:OfficeDocumentSettings>
        <o:PixelsPerInch>96</o:PixelsPerInch>
    </o:OfficeDocumentSettings>
    </xml>
    <![endif]-->
</head>
<body>
    <table role="presentation" cellpadding="0" cellspacing="0" border="0" style="width:600px; margin:0 auto;" align="center">
         <!-- STORY 2 CONTENT -->
      <tr>
        <td><!--[if mso | IE]> <table role="presentation" border="0" cellpadding="0" cellspacing="0" width="600" align="center" style="width:600px;"> <tr> <td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;"> <![endif]-->
          
          <div style="margin:0px auto;max-width:600px;background:#FFFFFF;">
            <table role="presentation" cellpadding="0" cellspacing="0" style="font-size:0px;width:100%;background:#FFFFFF;" align="left" border="0">
              <tr>
                <td style="text-align:left;vertical-align:top;border:0px;direction:ltr;font-size:0px;padding:0px 40px; display: inline-block;"><!--[if mso | IE]> <table role="presentation" border="0" cellpadding="0" cellspacing="0" style="width:100%;"> <tr> <td style="vertical-align:top;width:35%;"> <![endif]-->
                  
                  <div class="mw35" style="vertical-align:top;display:inline-block;direction:ltr;font-size:13px;text-align:left;width:100%;">
                    <table role="presentation" cellpadding="0" cellspacing="0" style="border:0px;vertical-align:middle;" width="100%" border="0">
                      <tr>
                        <td style="word-wrap:break-word;font-size:0px;padding: 0px 15px 20px 0px;" align="left"><table role="presentation" cellpadding="0" cellspacing="0" style="border-collapse:collapse;border-spacing:0px;" align="left" border="0">
                            <tr>
                              <td><a href="#" target="_blank" style="color: #323232; text-decoration: underline;"><img alt="image 2" height="auto" src="https://dummyimage.com/154x121/ecf8fb/fff" style="border:0px;border-radius:0px;display:block;font-size:13px;outline:none;text-decoration:none;width:100%;height:auto;"  width="154"></a></td>
                            </tr>
                          </table></td>
                      </tr>
                    </table>
                  </div>
                  
                  <!--[if mso | IE]> </td><td style="vertical-align:top;width:65%;"> <![endif]-->
                  
                  <div class="mw65" style="vertical-align:top;display:inline-block;direction:ltr;font-size:16px;text-align:left;width:100%;">
                    <table role="presentation" cellpadding="0" cellspacing="0" style="border:0px;vertical-align:top;" width="100%" border="0">
                      <tr>
                        <td style="word-wrap:break-word;font-size:0px;padding:0px 0px 10px 0px;" align="center"><div style="cursor:auto;color:#F15B5D;font-family:'Open Sans',arial,sans-serif; text-align:left;"> <span style="margin: 0; font-family:arial,helvetica,sans-serif; color:#333333; font-size:22px; line-height:26px; font-weight:normal;"><b>LOREM IPSUM 2</b></span> </div></td>
                      </tr>
                      <tr>
                        <td style="word-wrap:break-word;font-size:0px;padding:0px 0px 10px 0px;" align="center"><div style="cursor:auto;color: #727272;font-family:sans-serif;font-size:16px;font-weight:normal;line-height:25.2px;text-align:left;">
                            <p style="margin: 0;">Lorem ipsum dolor sit amet,consectetuer adipiscing elit,sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p>
                          </div></td>
                      </tr>
                      <tr>
                        <td style="word-wrap:break-word;font-size:0px;padding:10px 0px 30px 0px;" align="center"><table role="presentation" cellpadding="0" cellspacing="0" style="border-collapse:separate;" align="left" border="0">
                            <tr>
                              <td style="border:1px solid rgba(230,236,238,1);border-radius:4px;color:#FFFFFF;cursor:auto;padding:10px 20px;" align="center" valign="middle" bgcolor="#FFFFFF"><a href="#" style="text-decoration: none; background: #FFFFFF; color: #333333; font-family: sans-serif; font-size: 16px; font-weight: 400; line-height: 120%; text-transform: none; margin: 0px;" target="_blank"><span>CTA</span></a></td>
                            </tr>
                          </table></td>
                      </tr>
                    </table>
                  </div>
                  
                  <!--[if mso | IE]> </td></tr></table> <![endif]--></td>
              </tr>
            </table>
          </div></td>
      </tr>
    </table>
</body>
</html>

您可以找到test run for this code on Email on Acid here

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


使用本地python环境可以成功执行 import pandas as pd import matplotlib.pyplot as plt # 设置字体 plt.rcParams[&#39;font.sans-serif&#39;] = [&#39;SimHei&#39;] # 能正确显示负号 p
错误1:Request method ‘DELETE‘ not supported 错误还原:controller层有一个接口,访问该接口时报错:Request method ‘DELETE‘ not supported 错误原因:没有接收到前端传入的参数,修改为如下 参考 错误2:cannot r
错误1:启动docker镜像时报错:Error response from daemon: driver failed programming external connectivity on endpoint quirky_allen 解决方法:重启docker -&gt; systemctl r
错误1:private field ‘xxx‘ is never assigned 按Altʾnter快捷键,选择第2项 参考:https://blog.csdn.net/shi_hong_fei_hei/article/details/88814070 错误2:启动时报错,不能找到主启动类 #
报错如下,通过源不能下载,最后警告pip需升级版本 Requirement already satisfied: pip in c:\users\ychen\appdata\local\programs\python\python310\lib\site-packages (22.0.4) Coll
错误1:maven打包报错 错误还原:使用maven打包项目时报错如下 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources)
错误1:服务调用时报错 服务消费者模块assess通过openFeign调用服务提供者模块hires 如下为服务提供者模块hires的控制层接口 @RestController @RequestMapping(&quot;/hires&quot;) public class FeignControl
错误1:运行项目后报如下错误 解决方案 报错2:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project sb 解决方案:在pom.
参考 错误原因 过滤器或拦截器在生效时,redisTemplate还没有注入 解决方案:在注入容器时就生效 @Component //项目运行时就注入Spring容器 public class RedisBean { @Resource private RedisTemplate&lt;String
使用vite构建项目报错 C:\Users\ychen\work&gt;npm init @vitejs/app @vitejs/create-app is deprecated, use npm init vite instead C:\Users\ychen\AppData\Local\npm-
参考1 参考2 解决方案 # 点击安装源 协议选择 http:// 路径填写 mirrors.aliyun.com/centos/8.3.2011/BaseOS/x86_64/os URL类型 软件库URL 其他路径 # 版本 7 mirrors.aliyun.com/centos/7/os/x86
报错1 [root@slave1 data_mocker]# kafka-console-consumer.sh --bootstrap-server slave1:9092 --topic topic_db [2023-12-19 18:31:12,770] WARN [Consumer clie
错误1 # 重写数据 hive (edu)&gt; insert overwrite table dwd_trade_cart_add_inc &gt; select data.id, &gt; data.user_id, &gt; data.course_id, &gt; date_format(
错误1 hive (edu)&gt; insert into huanhuan values(1,&#39;haoge&#39;); Query ID = root_20240110071417_fe1517ad-3607-41f4-bdcf-d00b98ac443e Total jobs = 1
报错1:执行到如下就不执行了,没有显示Successfully registered new MBean. [root@slave1 bin]# /usr/local/software/flume-1.9.0/bin/flume-ng agent -n a1 -c /usr/local/softwa
虚拟及没有启动任何服务器查看jps会显示jps,如果没有显示任何东西 [root@slave2 ~]# jps 9647 Jps 解决方案 # 进入/tmp查看 [root@slave1 dfs]# cd /tmp [root@slave1 tmp]# ll 总用量 48 drwxr-xr-x. 2
报错1 hive&gt; show databases; OK Failed with exception java.io.IOException:java.lang.RuntimeException: Error in configuring object Time taken: 0.474 se
报错1 [root@localhost ~]# vim -bash: vim: 未找到命令 安装vim yum -y install vim* # 查看是否安装成功 [root@hadoop01 hadoop]# rpm -qa |grep vim vim-X11-7.4.629-8.el7_9.x
修改hadoop配置 vi /usr/local/software/hadoop-2.9.2/etc/hadoop/yarn-site.xml # 添加如下 &lt;configuration&gt; &lt;property&gt; &lt;name&gt;yarn.nodemanager.res