简体   繁体   English

Email 时事通讯未正确呈现

[英]Email newsletter not rendering correctly

I'm new in CSS and HTML.我是 CSS 和 HTML 的新手。 I have an email template with HTML and CSS code.我有一个带有 HTML 和 CSS 代码的 email 模板。 I put a pink circle box in my newsletter template to the top right: http://www.pedersenshotell.se/newsletter/我在我的通讯模板右上角放了一个粉红色的圆圈框: http://www.pedersenshotell.se/newsletter/

It looks OK on Firefox, Opera etc., but when I upload it to the Newsletter email campaign and send to Yahoo, Gmail, Outlook and Hotmail it looks so ugly. It looks OK on Firefox, Opera etc., but when I upload it to the Newsletter email campaign and send to Yahoo, Gmail, Outlook and Hotmail it looks so ugly. It shows a square box instead of a circle.它显示一个方形框而不是圆形。 Why?为什么?

HTML e-mails are tough things. HTML 电子邮件是困难的事情。 The email clients are often not normal browsers they don't render the HTML correctly and you'll be surprised why a normal thing (like background) is not working there. email 客户端通常不是普通的浏览器,它们无法正确呈现 HTML,您会惊讶为什么正常的东西(如背景)无法正常工作。

The web services are removing/blocking parts for security reasons and so on.出于安全原因等原因,web 服务正在删除/阻止部分。

I would stick with HTML 3.2 or simpler HTML solutions which are pretty annoying I know, and I recommend you to use Fractal which is an email validator service to check your work.我会坚持使用 HTML 3.2 或更简单的 HTML 解决方案,我知道这很烦人,我建议您使用Fractal ,它是 email 验证器服务来检查您的工作。

You can get hints from the Email Standards Project as well to see which functions are supported and which are not.您还可以从Email 标准项目中获得提示,以查看支持哪些功能,哪些不支持。

Ahh, and I almost forgot the most important part.啊,我差点忘了最重要的部分。 Please provide a web link on the top of the mail to provide a web based view of the newsletter, as usually "View this message as a Web page" or "Click here if the email is broken". Please provide a web link on the top of the mail to provide a web based view of the newsletter, as usually "View this message as a Web page" or "Click here if the email is broken".

I suspect that the page has a square box instead of a round one because you are viewing it in a browser that doesn't support the border-radius property. 我怀疑该页面有一个方形框而不是圆形框,因为您在不支持 border-radius属性的浏览器中查看它。

Please see border-radius for which browsers and versions have support for this property. 请参阅 border-radius ,了解哪些浏览器和版本支持此属性。

E-mail client support for border-radius is non-existent.不存在对边界半径的电子邮件客户端支持。

One solution here is to use a <img> instead of a CSS generated shape, although you may also find that e-mail clients block external content - a security feature which could result in a page that looks worse due to broken images.这里的一个解决方案是使用<img>而不是 CSS 生成的形状,尽管您可能还会发现电子邮件客户端会阻止外部内容 - 这是一项安全功能,可能会导致页面因图像损坏而看起来更糟。 Since you have other images on the page already this may not be a problem for you.由于页面上已经有其他图像,这对您来说可能不是问题。

Newsletters in email campaign tools like (outlook, gmail, hotmail) has less CSS support. email 活动工具(如(outlook、gmail、hotmail)中的时事通讯对 CSS 的支持较少。 Moreover, border-radius is supported for web browsers not for email clients.此外,web 浏览器支持border-radius ,而不是 email 客户端。

It is better to use <img> for background images, pure images, gradients, round corners and 3d related stuff instead of using CSS styling.最好将<img>用于背景图像、纯图像、渐变、圆角和 3d 相关的东西,而不是使用 CSS 样式。

See this reference: http://www.campaignmonitor.com/css/请参阅此参考: http://www.campaignmonitor.com/css/

This reference shows which CSS property is supported by different email clients.此参考显示不同 email 客户端支持哪个 CSS 属性。

It is VERY important to make you aware that browsers and email clients have 2 completely different ways of handling HTML and CSS.让您意识到浏览器和 email 客户端有两种完全不同的方式来处理 HTML 和 CSS 是非常重要的。

You can never make it 100% compatible in all clients using CSS and HTML in newsletters.您永远无法在时事通讯中使用 CSS 和 HTML 使其在所有客户端中 100% 兼容。 The only way, in my experience, to make newsletters 100% compatible is by writting the CSS inline in the HTML tags, like so:根据我的经验,使时事通讯 100% 兼容的唯一方法是在 HTML 标记中写入 CSS 内联,如下所示:

<td style="height:50px; width:100px; color: red; font-size: 12px; font-family: verdana;"> Content goes here </td>

As already stated HTML email clients have some issues which have to be considered.如前所述,HTML email 客户端有一些问题需要考虑。 The most important issue: Inline your CSS styles (most of the time).最重要的问题:内联您的 CSS styles(大部分时间)。

To help building HTML emails there are some nice boilerplate templates.为了帮助构建 HTML 电子邮件,有一些不错的样板模板。 Take a look at http://www.emailology.org/#1 or https://github.com/seanpowell/Email-Boilerplate and use these templates as a starting point.查看http://www.emailology.org/#1https://github.com/seanpowell/Email-Boilerplate并使用这些模板作为起点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM