-->

Automatically resizing a VML background image in O

2020-05-06 13:42发布

问题:

I know about the Bulletproof Email Backgrounds hack, but as this places a set-sized VML rectangle in the background, and then places the content within it, it doesn't resize.

Or to put it another way, the text in the table cell is cropped to the height of VML rectangle.

I've tried everything I can think of, but there doesn't appear to be anyway to allow the content of the VML rectangle to resize it.

Is there ANY other way of getting background images in Outlook?

回答1:

Besides VML, the only other way to get a background image in Outlook is in the body tag.

Here is the technique (works in all major clients):

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
</head>
<body style="margin: 0px; padding: 0px; background-image: url('http://lorempixel.com/100/100/'); background-color: #252525; background-repeat: repeat-y no-repeat; background-position: top left;" bgcolor="#252525">
<!-- BODY FAKE PANEL -->
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" background="http://lorempixel.com/100/100/">
  <tr>
    <td valign="top">
<!-- CENTER FLOAT -->
      <table width="600" height="800" border="0" valign="top" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
        <tr>
          <td align="center">
Center panel
          </td>
        </tr>
      </table>
<!-- /CENTER FLOAT -->
    </td>
  </tr>
</table>
<!-- /BODY FAKE PANEL -->
</body>
</html>