引用电子邮件中的HTML样式

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

我正在发送邮件报告(使用sendgrid),并且样式存在问题。收到的电子邮件在Gmail客户端中正确显示,但是当我尝试转发或回复此电子邮件时,样式会损坏。

[收到的电子邮件看起来像这样(很好):enter image description here

[当我尝试转发时,引用的电子邮件的样式显示为损坏:enter image description here

如何在html中管理样式以避免此问题?

谢谢!问候

html css email sendgrid
1个回答
0
投票

您必须内联CSS样式,以便它们成为HTML标记的一部分,而不是像在网络上链接普通HTML一样链接样式表。每个元素都需要在style属性中具有其相关样式,例如:

<table>
  <tr>
    <td align="center">
      <h1 style="font-family: Arial, sans-serif; font-size: 24px; line-height: 1.3; font-weight: bold; color: blue;">
        Your email title
      </h1>
      <p style="font-family: Arial, sans-serif; font-size: 16px; line-height: 1.5; color: #333333;">
        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam finibus varius ligula, eget dignissim dui ultrices vel. Nunc blandit turpis et sapien tincidunt, sed placerat ipsum convallis. Duis vel aliquet mi. In a ullamcorper nunc, in lobortis libero. Phasellus accumsan consectetur felis nec sodales.
      </p>
      <a style="font-family: Arial, sans-serif; font-size: 18px; font-weight: bold; line-height: 40px; height: 40px; color: red; height: 40px; background: white; border: 2px solid red; text-decoration: none;">
        A link button
      </a>
    </td>
  </tr>
</table>

希望对您有帮助。

© www.soinside.com 2019 - 2024. All rights reserved.