问题描述
我创建了HTML电子邮件,并且在Outlook 2007中查看时,看不到某些图像,因为它们是背景.我已经使用VML进行了一些修改,但是它不允许我将高度值留空,因为它的默认值为100px,否则我不能设置自动值或百分比值.背景图像需要能够根据文本大小调整大小,以便显示所有文本.
I have created a HTML email and when viewing in Outlook 2007 I couldn't see some images as they were backgrounds. I have done some hack using VML however it won't let me leave the height value blank as it defaults to 100px, or I can't put auto or a percentage. The background image needs to be able to resize depending on the text size so it shows all the text.
这是我正在使用的代码,除了高度值.
This is the code I have working except for the height values.
<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>
任何帮助将不胜感激.
推荐答案
使用:
<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:shape"中将高度更改为"auto",这在OL2007中对我有用.请记住,我的示例基于内容超过100像素的区域,因此我不确定该区域是否仍将默认值设为最小值100像素,如果您需要将其设置为小于该值,请在"v"中设置最大高度:形状"(低于100像素)(但显然这会阻止缩放到内容)
And then in your "v:shape" change height to "auto", this worked for me in OL2007.bearing in mind my example is based on a area that has content that exceeds 100px so I'm not sure if it still defaults at 100px as its minimum, if you need it to be less then set a max-height in the "v:shape" below 100px (but obviously this would prevent scaling to the content)
这篇关于Outlook中的HTML电子邮件呈现-VML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!