css padding is not working in outlook

后端 未结 14 1657
挽巷
挽巷 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:38

    I changed to following and it worked for me

    <tr>
        <td bgcolor="#7d9aaa" style="color: #fff; font-size:15px; font-family:Arial, Helvetica, sans-serif; padding: 12px 2px 12px 0px; ">                              
            <table style="width:620px; border:0; text-align:center;" cellpadding="0" cellspacing="0">               
                <td style="font-weight: bold;padding-right:160px;color: #fff">Order Confirmation </td>                    
                <td style="font-weight: bold;width:260px;color: #fff">Your Confirmation number is {{var order.increment_id}} </td>              
            </table>                    
        </td>
    </tr>
    

    Update based on Bsalex request what has actually changed. I replaced span tag

    <span style="font-weight: bold;padding-right:150px;padding-left: 35px;">Order Confirmation </span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <span style="font-weight: bold;width:400px;"> Your Confirmation number is {{var order.increment_id}} </span>
    

    with table and td tags as following

       <table style="width:620px; border:0; text-align:center;" cellpadding="0" cellspacing="0"> 
          <td style="font-weight: bold;padding-right:160px;color: #fff">Order Confirmation </td>
          <td style="font-weight: bold;width:260px;color: #fff">Your Confirmation number is {{var order.increment_id}} </td>
       </table>
    
    0 讨论(0)
  • 2020-12-01 01:45

    Unfortunately, when it comes to EDMs (Electronic Direct Mail), Outlook is your worst enemy. Some versions don't respect padding when a cell's content dictates the cell dimensions.

    The approach that'll give you the most consistent result across mail clients is to use empty table cells as padding (I know, the horror), but remember to fill those tables with a blank image of the desired dimensions because, you guessed it, some versions of Outlook don't respect height/width declarations of empty cells.

    Aren't EDMs fun? (No. They are not.)

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

    I had the same problem and ended up actually using border instead of padding.

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

    Just use
    <Table cellpadding="10" ..> ... </Table>
    Don't use px.Works in MS-Outlook.

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

    Padding will not work in Outlook. Instead of adding blank Image, you can simply use multiple spaces(& nbsp;) before elements/texts for padding left For padding top or bottom, you can add a div containing just spaces(& nbsp;) alone. This will work!!!

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

    Do this instead:

    <table width="100%" border="0" cellpadding="0" cellspacing="0">
      <tr>
          <td bgcolor="#7d9aaa" width="40%" style="color: #ffffff; font-size:15px; font-family:Arial, Helvetica, sans-serif; font-weight: bold; padding:12px;">
            Order Confirmation
          </td>
          <td bgcolor="#7d9aaa" align="right" width="60%" style="color: #ffffff; font-size:15px; font-family:Arial, Helvetica, sans-serif; font-weight: bold; padding:12px;">
            Your Confirmation number is {{var order.increment_id}}
          </td>
      </tr>
    </table>
    

    It is better to use two cells and align the content, than using large padding and &nbsp;'s.

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