2

For the purpose of an email template, I need to implement a background image in the <table> and its contain texts over image. Now I have tried:

https://stackoverflow.com/a/15620571/6191987

<!--[if gte mso 9]>
<v:background xmlns:v="urn:schemas-microsoft-com:vml" fill="t">
<v:fill type="tile" src="http://i.imgur.com/n8Q6f.png" color="#f6f6f6"/>
</v:background>
<![endif]-->

Its not working latest versions of MS Outlook (Version 16005.11029.20108.0 & Version 1908 Build 11929.20562),

But working fine with older versions.

Any new method to solve this problem?

vishnu
  • 2,848
  • 3
  • 30
  • 55

2 Answers2

1

Have you tried declaring VML have this in your html tag?

<html lang="en" xmlns="http://www.w3.org/1999/xhtml"
        xmlns:v="urn:schemas-microsoft-com:vml"
        xmlns:o="urn:schemas-microsoft-com:office:office">

Also what are the dimensions of your bg img? Outlook has a max img height of 1728px and won't show the image if it is over that. And it will not show correctly if the bg img is retina.

Richard Clifford
  • 494
  • 3
  • 17
0

Found this solution

From: https://litmus.com/community/discussions/357-outlook-07-13-full-width-background-image

This works in Outlook, Office 365, Gmail etc. also in normal & 4k screens.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta name="format-detection" content="telephone=no" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <meta name="apple-mobile-web-app-capable" content="yes" />
  <meta name="apple-mobile-web-app-status-bar-style" content="black" />
  <title>Test</title>
  <style>
    v\:* {
      behavior: url(#default#VML);
      display: inline-block
    }
    
    o\:* {
      behavior: url(#default#VML);
      display: inline-block
    }
    
    w\:* {
      behavior: url(#default#VML);
      display: inline-block
    }
    
    body {
      margin: 0;
      padding: 0;
      width: 100%;
      -webkit-text-size-adjust: none !important;
      -ms-text-size-adjust: none !important;
    }
  </style>

  <!--[if gte mso 9]><xml>
 <o:OfficeDocumentSettings>
  <o:AllowPNG/>
  <o:PixelsPerInch>96</o:PixelsPerInch>
 </o:OfficeDocumentSettings>
</xml><![endif]-->

</head>

<body style="padding: 0; margin: 0; -webkit-text-size-adjust: none !important;color:#fff;font-family:sans-serif;font-size: 18px;">
  <table cellspacing="0" cellpadding="0" border="0" bgcolor="#0058a5" width="100%">
    <tr>
      <td height="50">&nbsp;</td>
    </tr>
  </table>
  <table width="100%" cellspacing="0" cellpadding="0" border="0">
    <tr>
      <td height="150" bgcolor="#0086cc" background="http://i.imgur.com/HzZCJei.png" style="height: 150px;" align="center">
        <!--[if gte mso 9]>
        <v:rect stroke="f" fill="t" style="mso-width-percent: 1000;height:150px; position: relative; z-index: 0; mso-width-relative:margin;">
        <v:fill type="frame" src="http://i.imgur.com/HzZCJei.png" color="#0086cc" />
        </v:rect>
        <![endif]-->
        Text goes here!
      </td>
    </tr>
  </table>
</body>

</html>
vishnu
  • 2,848
  • 3
  • 30
  • 55