Image style height and width not taken in outlook mails

后端 未结 9 2072
情书的邮戳
情书的邮戳 2020-12-08 01:34

I have a following dom structure in html content I am sending as email.



        
相关标签:
9条回答
  • 2020-12-08 02:23

    Put the width and height in separate attributes, with no unit:

    <img style="margin: 0; border: 0; padding: 0; display: block;"
    src="images/img.jpg" width="120" height="150">
    

    Another Option:

    <!--[if gte mso 9]>
    <style type="text/css">
    img.header { width: 600px; } /* or something like that */
    </style>
    <![endif]-->
    
    0 讨论(0)
  • 2020-12-08 02:26

    I have same problem for image which is not showing correctly in outlook.and I am using px and % for applying height and width for image. but when i removed px and % and using only just whatever the value in html it is worked for me. For example i was using : width="800px" now I'm using widht="800" and problem is resolved for me.

    0 讨论(0)
  • 2020-12-08 02:33

    I had the pleasure of creating an email for outlook 2010 based on sharepoint data. But when creating an outlook email, outlook in its wisdom reduces the image width and height to cm. Interestingly using the width and height kicks in correctly when you forward the email but not when you open it.

    Hack Fix:

    I had an image [720px X 150px] which should be [19.05cm X 3.98cm]. BUT outlook set the image width and height to [15.24cm X 3.18cm]. Clearly this is a problem.

    The hack I used was setting the html image tag as follows:

    <img src="...." style="width:720px; heigh:150px" width="900" height="187.5" />
    

    Why that width and height?

    Well it is the ratio (25% increase) between

    • what outlook was saying and
    • what it should be by adding 25% of the current size; which is (720 X 1.25 = 900) and (150 X 1.25 = 187.5).

    Its not pretty but it works.

    0 讨论(0)
提交回复
热议问题