SVG background image not showing in Mailchimp template

3.5k views Asked by At

I have an HTML newsletter with a base64 encoded svg background image like so:

<table 
       border="0" 
       cellpadding="0"
       cellspacing="0" 
       class="container" 
       width="630" 
       style="
              background-color: #ffffff; 
              background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0nMTAwMHB4JyBoZWlnaHQ9JzEwMDBweCcgdmlld0JveD0nMCAwIDEwMDAgMTAwMCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJz48cGF0aCBjbGFzcz0ndHJpYW5nbGVzaGFwZScgc3R5bGU9J2ZpbGw6cmdiYSg0NiwxODIsMjQ4LDAuMyk7JyBkPSdNMCwwIEwxMDAwLDAgTDAsMTAwMCBMMCwwIFonPjwvcGF0aD48L3N2Zz4='); 
              background-repeat: no-repeat; 
              background-position: left top; 
              background-size: 55.8%;"
>

Even though svg support in HTML email is limited I want to include it to target clients that do support it. When I paste my HTML code into a Mailchimp campaign it is working, it is shown in several email clients. But when I import the HTML into a Mailchimp template and then create campaigns from that template the svg is not shown anymore in the delivered email (where it previously did show).

What could it be that Mailchimp does to this code when using it inside a campaign generated from a template?

2

There are 2 answers

1
Gortonington On

I don't think it is Mailchimp that is the issue, I think it is that you are embedding the image. This is an inconsistent method by itself and then you are using an SVG file (spotty support as you mentioned) and using CSS to declare a background which is also spotty. I would likely look to host the file externally as there is little evidence embedded images provide any benefits really and then use backgrounds.cm to create a more comprehensive background image set up (and include a backup jpg or png image for those clients that do not support SVG.

0
clayRay On

In order for the above to work in MailChimp, I would recommend NOT using inline styling inside the <table> code. MailChimp prefers you putting all your CSS in a <style> block inside your template's <head> block.

However, regardless of this, and regardless of whether the image is embedded or not, many email clients still don't support SVG.

Here is a up-to-date guide of what works and what doesn't.