How to retain image dimensions in Mailchimp templates

风流意气都作罢 提交于 2019-11-30 10:08:34

For others reference I have now spoken to mailchimp and using a combination of the code at https://www.snip2code.com/Snippet/25348/HTML-Email-Template--max-width-hack-for- (below) and max-width/max-height css values for the img fixes the problem in outlook:

<!--[if (gte mso 9)|(IE)]>
<center>
  <table>
    <tr>
      <td width="600">
        <![endif]-->
        <div style="max-width: 600px; margin: 0 auto;">
          <p>This text will be centered and constrained to 600 pixels even on Outlook which does not support max-width CSS</p>
        </div>
        <!--[if mso]>
      </td>
    </tr>
  </table>
</center>
<![endif]-->

To get around this issue you must have a max-width specified on the actual image itself, and make sure it's inlined onto the tag like this:

<img mc:edit="image" src="image.jpg" width="200" style="max-width:200px;">

It doesn't count if it's included in the CSS in the head.

With the markup above the MailChimp editor adds the width="200" AFTER the user edits the image. But if the user doesn't edit the image, sadly no width is added so the fixes above would be worth a try.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!