Use Code Content Blocks

Use the Code content block to add HTML code directly into your email campaign. This block is useful if you want more control of your design than what our other content blocks provide.

In this article, you’ll learn how to add a Code content block to your email campaign.

Before You Start

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

  • This is an advanced feature and is recommended for users familiar with custom coding. Contact your developer, or hire a MailChimp Expertif you need assistance.
  • Code content blocks do not include built-in padding.
  • We recommend that you send test emails or use our Inbox Previewtool to get an idea of how your campaign will look in different email clients.

Insert the Code Block

To insert a Code content block, follow these steps.

  1. In the Content section of the Campaign Builder, click Edit Design. click edit design
  2. On the Design step, click and drag the Code block into your campaign layout.
    click and drag Code block into campaign layout
  3. In the editing window, type or paste in your code.
    Paste code into the Code block editing window
  4. Click Save & Close.

Code Block Tips

Here are are some tips for how to use the Code content block.

  • Don't use JavaScript.
    Because most email clients block JavaScript to protect against viruses, we automatically remove all detectable JavaScript from your code.
  • Don't use a word-processing program to create HTML content.
    Programs like Microsoft Word or Publisher can add extra styling code, and distort your campaign. We recommend that you write the HTML code in a simple text editor and then paste the code into the Code block.
  • Use embedded or inline CSS.
    In most cases, external CSS files will not work in HTML email. You can add embedded or inline CSS to a Code block, preferably above the body section of your campaign layout. For the best results, we recommend you use inline CSS.
  • Use media queries to ensure responsive design.
    If you want your code to be mobile responsive, you’ll need to include media queries. A media query is a CSS component that allows your content to adapt to different devices. To learn more, check out the W3C Recommendation for Media Queries and the Litmus guide to How to Code a Responsive Email from Scratch.
  • Use the Content Manager or absolute paths for images and files.
    Use our Content Manager to host files and images for your campaign. Grab the file URL from the Content Manager and paste it into your code in the Code block. If you host your images on your own server, use absolute paths.
Was this article helpful?
Anything else we can do to improve our site?

Technical Support