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

问题描述 投票:0回答:1

我正在发送以下带有样式的 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>
email html-email email-client email-templates
1个回答
0
投票

问题是

<style>
标签中的评论,其中包含单词
<style>

看来 iCloud 解析得不好,可能会切断整个

<style>
部分或部分内容并破坏 CSS。

结论:
为了安全起见,评论中不要有 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>
© www.soinside.com 2019 - 2024. All rights reserved.