简体   繁体   English

Gmail 中不显示背景图片

[英]Background image doesn't show up in Gmail

I coded an html email, and just tested in Gmail.我编写了一个 html 电子邮件,并在 Gmail 中进行了测试。 Everything shows up fine besides for a background image.除了背景图像外,一切都很好。 I put the background image on my wrapper table, like this:我将背景图像放在包装表上,如下所示:

<table cellpadding="0" cellspacing="0" border="4px solid grey" align="left"  background="http://www.totalrecallsolutions.com/corporate/email templates/images/appt_reminder_one_bg.jpg">

And still, there is no image showing up in Gmail.而且,Gmail 中仍然没有显示图像。 I understood from my google searches that this is the correct way to make a background image show up in Gmail.我从谷歌搜索中了解到,这是在 Gmail 中显示背景图片的正确方法。 So why is it not showing up?那为什么不显示呢?

Thanks!!谢谢!!

Besides the url with spaces, there's another thing, Gmail doesn't allow url() attribute in inline css除了带有空格的 url,还有一件事,Gmail 不允许内联 css 中的url()属性

Don't use background images.不要使用背景图片。 Gmail, among others, will ignore any url() attribute in an inline style, and the simple background= tag attribute. Gmail 等将忽略内联样式中的任何 url() 属性,以及简单的 background= 标签属性。 You can use background colors if you wish (bgcolor tag attribute or background-color: css statement).如果您愿意,您可以使用背景颜色(bgcolor 标记属性或 background-color: css 语句)。

Here is the link where I read that: http://groundwire.org/support/articles/css-and-email-newsletters这是我阅读的链接: http : //groundwire.org/support/articles/css-and-email-newsletters

Regards问候

Gmail has added support for background and background-image properties last February (according to Campaign Monitor ). Gmail 去年 2 月增加了对背景和背景图像属性的支持(根据Campaign Monitor )。

But in order for it to show, your code must contain at least one < img > tag.但是为了显示它,您的代码必须至少包含一个 < img > 标签。 You can use spacer.gif to trick it (or any transparent image for that matter).您可以使用 interval.gif 来欺骗它(或任何与此相关的透明图像)。

In my case I had CSS styles defined for background-repeat and background-size in a style tag that was being transformed to a single inline background: no-repeat/cover that was overriding the background attribute for my table.在我的例子中,我在一个样式标签中为 background-repeat 和 background-size 定义了 CSS 样式,该样式标签被转换为单个内联背景: no-repeat/cover 覆盖了我的表格的背景属性。 Using just worked for me使用对我有用

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

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