2012-08-02 103 views
3

我创建了一个HTML电子邮件,并且在Outlook 2007中查看时,我无法看到一些图像,因为它们是背景。我使用VML做了一些破解,但它不会让我将高度值留空,因为它默认为100px,或者我不能放置自动或百分比。背景图片需要能够根据文字大小调整大小,以显示所有文字。HTML电子邮件呈现在Outlook中 - VML

这是我除了高度值以外的代码。

<td colspan="6" align="center" valign="top" style="background-image: url('http://example.com/content_centre.png');" background="http://example.com/content_centre.png"> 
    <!--[if gte mso 9]> 
     <v:rect xmlns:v="urn:schemas-microsoft-com:vml" style="width:620px;height:200px;" strokecolor="none"> 
      <v:fill xmlns:v="urn:schemas-microsoft-com:vml" type="tile" color="#DDDDDD" src="http://example.com/content_centre.png" /></v:fill> 
     </v:rect> 
     <v:shape xmlns:v="urn:schemas-microsoft-com:vml" id="theText" style="position:absolute;width:620px;height:200px;"> 
    <![endif]--> 
    <table cellspacing="0" cellpadding="0" border="0" style="width:100%;"><tr> 
     <td width="30"></td> 
     <td align="left" style="font-family:Arial, Helvetica, sans-serif; background:#ffffff; "> 
      <p>This is where the text will appear. Doesn’t matter how much text it just stops displaying it.</p></td> 
     <td width="30"></td> 
    </tr> 
    </table> 
    <!--[if gte mso 9]> 
     </v:shape> 
    <![endif]--> 
    </td> 

任何帮助,将不胜感激。

+0

我已经在这里提供了对这个问题的答案,希望它可以帮助你:http://stackoverflow.com/questions/23280715/full-width -backgrounds-上的前景,13年7月10日 – davidcondrey 2014-05-07 07:32:39

回答

1

用途:

<v:image xmlns:v="urn:schemas-microsoft-com:vml" id="theImage" style='behavior: url(#default#VML); display:inline-block; position:absolute; height:200px; width:620px; top:0; left:0; border:0; z-index:1;' src="http://example.com/content_centre.png"/> 

不是:

<v:rect 

,然后在 “V:形” 变化的高度为 “自动”,这为我工作在OL2007。请注意,我的示例基于内容超过100像素的区域,因此我不确定它是否仍将默认值设置为100像素作为其最小值,如果您需要的话,它不会在“v”中设置最大高度:形状“低于100像素(但显然这会阻止缩放内容)