How keep background image from repeating in Outlook 2007 and up

Cmaso picture Cmaso · Jan 12, 2015 · Viewed 18.9k times · Source

I'm using VML for a background image in an html email. The background repeats in MSO 12, 14, and 15, despite a "no-repeat" value in the VML object. Code below:

<td align="center" valign="top" style="background-image: url('http://secure.sportssystems.com/eventdata/6389/images/APIInviteBackground.jpg'); background-repeat:no-repeat; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; background-position: top center;">
    <xsl:comment><![CDATA[[if gte mso 9]>
        <v:rect xmlns:v="urn:schemas-microsoft-com:vml" fill="true" stroke="false" style="background-repeat: no-repeat; mso-width-percent:1000; height:775px; top: 0; left: 0; border: 0;z-index: 1">
             <v:fill type="tile" src="cid:http://.../myimage.jpg" />
    <![endif]]]></xsl:comment>

I've also tried using v:background:

<v:background xmlns:v="urn:schemas-microsoft-com:vml" fill="t" style="background-repeat: no-repeat; mso-width-percent:1000; height:775px;">
    <v:fill type="tile" src="cid:http://secure.sportssystems.com/eventdata/6389/images/APIInviteBackground.jpg" />
</v:background>

But then I get no background. I'll keep plugging, as I have a feeling the solution is something simple, but would appreciate any help...

Answer

Gortonington picture Gortonington · Apr 14, 2015

Change <v:fill type="tile" to <v:fill type="frame" and make sure that you have the rect the same size as the td. Using MSO-width-percent can be glitchy to a degree. As it would only be rendered on the desktop version, you should have no real issues declaring a preset value for this conditional code and I would recommend doing this.