简体   繁体   中英

space issue in html email outlook 2010

Hi i have a issue in outlook 2010 i want to give 10px space between the tds but its not working. please help.

<table style="cellspacing:0px;cellpadding:0px;border:0;border-spacing:10px;">
 <tbody>
<tr>
  <td id="cont0" align="top" style="border-collapse:collapse;padding:0;overflow: hidden;height: 96px; width: 96px;margin-right:auto;vertical-align:top;border: 1px solid #CCCCCC;">
    <a id="link0" href="#" style="border:0">
      <img id="previewimage0" style="border:0" src="http://i.sample.com/00/s/MTY2WDIwMA==/$(KGrHgoS,KEEk,K!Bv9GBQIi!CNhLg~~60_0.JPG">
    </a>
  </td>
  <td id="cont1" align="top" style="border-collapse:collapse;padding:0;overflow: hidden;height: 96px; width: 96px;margin-right:auto;vertical-align:top;border: 1px solid #CCCCCC;">
    <a id="link1" href="#" style="border:0">
      <img id="previewimage1" style="border:0" src="http://i.sample.com/00/s/MTQ5WDIwMA==/$(KGrHqERQ,IE+tWswcklBQIi!C8rQg~~60_0.JPG">
    </a>
  </td>
</tr>
</tbody>
</table>

try adding a table cell between them with the width of 10px :

</td>
<!-- your first td ends -->
<!-- the spacer td -->
<td align="top" width="10>&nbsp;</td>
<!-- your second td begins -->
<td id="cont1" align="top">

Works for my email templates everytime in all email clients.

尝试将cellspacing属性添加到table标记

<table cellspacing="10" style="border:0;">

Marks answer will do the job perfectly, don't add cellspacing or cellpadding as it is incredibly inconsistent across email clients, I would also say don't use margin and padding for the same reason but in rare cases where you cannot use any other spacing method you wont have any choice. For your border I would also avoid using the shorthand and set each part of the border individually:

border-color: #ffffff;
border-style: solid; 
border-width: 1px;

as some clients will just ignore the shorthand version.

where possible you should use html styling rather than inline css, as even though inline is the only real way to use css, html is still more widely recognised across older email clients.

valign="top"
cellpadding="0"
cellspacing="0"

all of these can be added to the tag rather than including them in styles. This will ensure any old clients or even just company webmails wont kick up a fuss.

I know you didn't ask about it, but just for consistencies sake I thought I would point that out.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM