css padding is not working in outlook

后端 未结 14 1659
挽巷
挽巷 2020-12-01 01:19

I have following html in email template.

I am getting different view in MS Outlook and in gmail for the same.


    

        
相关标签:
14条回答
  • 2020-12-01 01:49

    My solution is to use an empty / whichever is needed with a transparent spacer gif since padding isnt 100% supported.

    <td width="2" style="font-size:1px; line-height:1px;" bgcolor="#FFFFFF">                                                                                                       
       <img width="2" border="0" src="spacer50.gif" style="display:block; 
       padding:0; margin:0; border:none;" />                                                                                                
    </td>
    
    0 讨论(0)
  • 2020-12-01 01:50

    To create HTML in email template that is emailer/newsletter, padding/margin is not supporting on email clients. You can take 1x1 size of blank gif image and use it.

    <tr>
      <td align="left" valign="top" style="background-color:#7d9aaa;">
        <table width="640" cellspacing="0" cellpadding="0" border="0">
          <tr>
            <td align="left" valign="top" colspan="5"><img style="display:block;" src="images/spacer.gif" width="1" height="10"  alt="" /></td>
          </tr>
          <tr>
            <td align="left" valign="top"><img style="display:block;" src="images/spacer.gif" width="20" height="1"  alt="" /></td>
            <td align="right" valign="top"><font face="arial" color="#ffffff" style="font-size:14px;"><a href="#" style="color:#ffffff; text-decoration:none; cursor:pointer;" target="_blank">Order Confirmation</a></font></td>
            <td align="left" valign="top" width="200"><img style="display:block;" src="images/spacer.gif" width="200" height="1"  alt="" /></td>
            <td align="left" valign="top"><font face="arial" color="#ffffff" style="font-size:14px;">Your Confirmation Number is 260556</font></td>
            <td align="left" valign="top"><img style="display:block;" src="images/spacer.gif" width="20" height="1"  alt="" /></td>
          </tr>
          <tr>
            <td align="left" valign="top" colspan="5"><img style="display:block;" src="images/spacer.gif" width="1" height="10"  alt="" /></td>
          </tr>
        </table>
    </td>
    </tr>
    
    0 讨论(0)
  • 2020-12-01 01:50

    In some cases we set border instead of padding and it works in outlook.

    border: solid #efeeee;border-width: 20px 40px;
    
    0 讨论(0)
  • 2020-12-01 02:00

    All styling including padding have to be added to a td not a span.

    Another solution put the text into <p>text</p> and define margins, and that should give the required padding.

    For example:

    <p style="margin-top: 10px; margin-bottom: 10; margin-right: 12; margin-left: 12;">text</p>
    
    0 讨论(0)
  • 2020-12-01 02:01

    have you tried display:inline-block;?

    0 讨论(0)
  • 2020-12-01 02:02

    Make sure to throw on the !important for Outlook especially.

    td {
    border-collapse: separate;
    padding: 15 !important
    }
    

    I also wanted borders, so might not work for someone who doesn't.

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