CMS Development

andre9000
Contributor

Email - hubspot overwrites image width attribute

Hi,

 

We are working on building some email modules. We are using the data-hse-inline-css style tag for inlining email styles. This is the code we are trying to generate:

 

<img src="..." width="250" height="100" style="width:100%;max-width:250px;">

HS code looks like this:

 

 

<style type="text/css" data-hse-inline-css="true">
img {
  width: 100%;
  max-width: 250px;
}
</style>

<img src="{{ module.logo.src }}" width="{{ module.logo.width }}" height="{{ module.logo.height }}">

However, it seems that thubspot also sets the width-property on the image, so in the generated markup the img element has width="100%" (instead of width="250"). 

 

This even happens when not using data-hse-inline attribute at all:

<img src="{{ module.logo.src }}" width="{{ module.logo.width }}" height="{{ module.logo.height }}" style="width:100%;max-width:{{ module.logo.width }}px;">

 

0 Upvotes
1 Reply 1
roisinkirby
HubSpot Product Team
HubSpot Product Team

Email - hubspot overwrites image width attribute

Hey @andre9000 could you share a link to the preview of your email so experts on the Community can inspect your code further? Thank you!

0 Upvotes