电子邮件模板未在带有嵌入式CSS的iCloud客户端上加载

Email template not loading on iCloud client with embedded CSS

提问人:Mario Petrovic 提问时间:7/28/2023 更新时间:7/28/2023 访问量:25

问:

我正在发送以下带有样式的 HTML 模板,但我没有看到样式,只有裸露的 HTML。

<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <style>
      /* This class will provide override text size imposed by the inherited css.
        In this <style> this style will be loaded before
      */

      .my-class {
        background-color: red;
        font-size: 12px !important;
      }
    </style>
  </head>
  <body>
    <div class="my-class">Some text</div>
  </body>
</html>
电子邮件 html-email email-client email-templates

评论


答:

0赞 Mario Petrovic 7/28/2023 #1

问题是标签中的注释,其中包含单词。<style><style>

iCloud似乎不能很好地解析这一点,并且可能它切断了整个部分或部分并破坏了CSS。<style>

结论:
为了安全起见,评论中不要有 HTML 标签或类似内容。

这个 HTML 还可以。我只是没有改写它:<>

<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <style>
      /* This class will provide override text size imposed by the inherited css.
        In this style tag this style will be loaded before
      */

      .my-class {
        background-color: red;
        font-size: 12px !important;
      }
    </style>
  </head>
  <body>
    <div class="my-class">Some text</div>
  </body>
</html>