SOLVED

Setting mktoImgWidth to 100%

Go to solution
Geoff_Krajeski1
Level 10 - Champion Alumni

Setting mktoImgWidth to 100%

I have only seen syntax for pixel widths for the mktoImgWidth attribute.

Does anyone know how to set it so the <img> returned has width="100%" as an attribute?

Tried this without success:

<div class="mktoImg" id="heroImage" mktoName="Hero Image" mktoImgWidth="100%" mktoImgSrc="image-source-url.jpg"></div>
1 ACCEPTED SOLUTION

Accepted Solutions
Casey_Grimes
Level 10

Re: Setting mktoImgWidth to 100%

Personally, I wouldn't use 100% for image width settings, because this encourages end users to not properly scale their images to 1x/2x, thus causing blurriness on the rendering end. It's much more straightforward to use CSS (so you can responsively scale for both older clients like Outlook and support high-DPI devices) and placeholder images that clearly denote the image size in pixels. For example, if 100% of your email's width translates to 500px, I'll put a 1000px image in and set it to 500px for screens that are 500px and above, but 100% for those 499px and below to allow for correct scaling. You get your high DPI for devices that support it, a pixel lock for Outlook, and scaling for smaller screens.

View solution in original post

3 REPLIES 3
Gerard_Donnell4
Level 10

Re: Setting mktoImgWidth to 100%

Hi Geoffrey Krajeski​,

Have you tried using just the width element on the td tag?

Here is the code I use for a banner.

<table class="mktoModule" id="mkto-banner-700b294445e-f7fc-4a41-ae0e-86afc0ed6f6c" mktoname="Banner 700" style="padding-bottom:15px;" width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#ffffff">

                      <tbody>

                        <tr>

                          <td>

                            <table class="container" width="700" align="center" border="0" cellspacing="0" cellpadding="0" style="">

                              <tbody>

                                <tr>

                                  <td valign="top" bgcolor="#ffffff" class="banner" width="100%">

                                    <div class="mktoImg" id="mkto-banner-image-700b294445e-f7fc-4a41-ae0e-86afc0ed6f6c" mktoname="Banner Image 700" mktolockimgsize="true">

                                      <a href="#"><img src="http://placehold.it/700x180" alt="Add alt text here" class="bannerl"></a>

                                    </div> </td>

                                </tr>

                              </tbody>

                            </table> </td>

                        </tr>

                      </tbody>

                    </table>

Casey_Grimes
Level 10

Re: Setting mktoImgWidth to 100%

Personally, I wouldn't use 100% for image width settings, because this encourages end users to not properly scale their images to 1x/2x, thus causing blurriness on the rendering end. It's much more straightforward to use CSS (so you can responsively scale for both older clients like Outlook and support high-DPI devices) and placeholder images that clearly denote the image size in pixels. For example, if 100% of your email's width translates to 500px, I'll put a 1000px image in and set it to 500px for screens that are 500px and above, but 100% for those 499px and below to allow for correct scaling. You get your high DPI for devices that support it, a pixel lock for Outlook, and scaling for smaller screens.

Geoff_Krajeski1
Level 10 - Champion Alumni

Re: Setting mktoImgWidth to 100%

I ended up just adding a class to the <div> and then set via CSS as Courtney Grimes​ suggested