Add a Background Image to a Custom HTML Template

This feature requires Author user level or higher and is part of paid features.

To further enhance the design of your marketing campaigns, you can add a background image to a Code your own template in MailChimp’s Template Builder.

Custom HTML templates are an advanced feature and are recommended for users familiar with custom coding. Contact your developer, or hire a MailChimp Expert if you need assistance.

In this article, you’ll learn how to add a background image to your custom HTML template.

Before You Start

Here are some things to know before you begin this process.

  • Background images may not render in every email client, so make sure you know which email clients support background images by reviewing our Email Client CSS Support article for details.

  • Large images can cause campaigns to display incorrectly in your recipients' inboxes. For best results, set the resolution to 920 x 1080px or less, and compress the image.

  • Host your images on a public server or use a free service like Imgur or Flickr, and use an absolute file path that points directly to the file location in the code. Be aware that if you host your own images on a private server, recipients without access to the server won’t be able to see the image.

  • MailChimp can also host your images for you in the File Manager if they are less than 10MB.

  • You can also add a background image to a regular campaign. To learn more, take a look at our Add a Background Image to a Campaign article.

Add a Background Image to your Custom HTML Template

This process uses CSS, HTML, and VML to display a background image and color. You’ll paste our example code into your template and change the placeholder image and background color to your own specifications.

To add a background image to a custom HTML template, follow these steps.

  1. Navigate to the Templates page.

  2. Click Create Template.
    Cursor click on create template button

  3. Click the Code your own tab, and select Paste in code.
    Cursor on paste in code button

  4. In the Code Editor, insert the following code just after the opening <body> tag to add the placeholder background image and color.

    <div style="background-color:#7bceeb;">
    <!--[if gte mso 9]>
        <v:rect xmlns:v="urn:schemas-microsoft-com:vml" fill="true" stroke="false" style="mso-width-percent:1000;">
        <v:fill type="frame" src=""color="#7bceeb" />
        <v:textbox style="mso-fit-shape-to-text:true" inset="0,0,0,0">
     <table height="100%" width="100%" cellpadding="0" cellspacing="0" border="0">
         <td valign="top" align="left" background="" style="background-repeat:no-repeat; background-size:cover;"> 
    This example shows the image and color values in bold. You’ll replace these with your image and color information in the next step.
  5. Replace the two placeholder background image URLs and placeholder background color values in this code example with the color hex code of your choice and the absolute file path for your image URL.

  6. Insert the following code just before the closing <body> tag:
     <!--[if gte mso 9]>
  7. Replace or edit the remaining campaign code with your own custom HTML.

  8. When you're done editing the code, click Save.
    Cursor click on save button
  9. Click Save and Exit.

  10. In the Save Template pop-up modal, name your template.

  11. Click Save. Your new template can be found on the Templates page and on the Templates step of the Campaign Builder.

Testing and Troubleshooting

Before you send to your entire list, thoroughly preview and test your template and send a few test emails to yourself. To see how certain email clients will display your background image, use the Inbox Preview tool.

Preview and Test Your Campaign

Test with Inbox Preview

Here are a few other tips for working with background images.

  • The background image will not display if images are turned off in your recipient’s inbox. For this reason, be sure you choose a background color that will display your text properly if the background image doesn’t load.

  • When editing your CSS, make sure you don’t have any other background properties in your code, because they can override the background image.

  • When working in the Template Editor, merge tags will not render in previews or test emails. If you want to see how merge tags will render for subscribers, create a campaign from the template, and use our preview and test options.

Was this article helpful?
What can we do to improve articles like this?

Technical Support