Search code examples
emailhtml-emailmailchimp

How can I maintain image class when using mc:edit in a MailChimp template?


I'm trying to create a MailChimp template where an image is editable using mc:edit

Here's the code:

<img class="flexibleImage" mc:edit="top_image">

This seems all good, but once I edit this image using the MailChimp editor, I lose the original class "flexibleImage" and all other class and style info related to that img element.

How can I create a template with an editable image and maintain (or add) that class?


Solution

  • For anyone else with the problme, this answer is based on a response from MailChimp support:

    It looks like it isn't possible to keep a custom class attached to an editable image. What you could do instead though is apply the class to the image's containing element. So if the image is in a <div>, add flexibleImage to the div, and then update your CSS rules to point to .flexibleImage>img.