Issue in creating email teamplate

浪子不回头ぞ 提交于 2019-12-02 09:26:37

As I said:

If it was me i would make the top border and the image a row. – Alex Thomas 23 mins ago

Change you top row to:

<td valign="bottom">
    <b style="border-top-left-radius:5px; background-color:#fff; display:block; border:3px solid #a3a9ac; border-bottom:0; height:100%; margin:0; padding-bottom:20px; border-right:none;">&nbsp;</b>
</td>
<td class="text-center" width="64">
    <img class="top-image" src="https://cdn1.iconfinder.com/data/icons/WPZOOM_Social_Networking_Icon_Set/64/gmail.png">    </td>
<td valign="bottom">
    <b style="border-top-right-radius:5px; background-color:#fff; display:block; border:3px solid #a3a9ac; border-bottom:0; height:100%; margin:0; padding-bottom:20px; border-left:none;">&nbsp;</b>
</td>

check out the result - http://jsfiddle.net/562ux.

I've not tested this in a email Client, but as @Kheema Pandey says, you should try to use inline styles.

Updated answer:

You can't use negative margin in html email. To mimic this, there are 2 ways to do it, the nested tables way and the more complex rowspan way:

<!-- The nested way -->

<table width="500" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC"><!-- coloring the whole table instead of just the cells you want, will stop gaps forming on forwarding from Outlook -->
  <tr>
    <td width="200" height="80"  bgcolor="#007700">
      <table width="100%" height="80" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td height="40" bgcolor="#FFFFFF">&nbsp;
          </td>
        </tr>
        <tr>
          <td height="40" bgcolor="#CCCCCC">&nbsp;
          </td>
        </tr>
      </table>
    </td>
    <td width="100" height="80" bgcolor="#4444FF">
     <img alt="" src="" width="100" height="80" style="margin: 0; border: 0; padding: 0; display: block;">
    </td>
    <td width="200" height="80" bgcolor="#FFFFFF">
      <table width="100%" height="80" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td height="40" bgcolor="#FFFFFF">&nbsp;
          </td>
        </tr>
        <tr>
          <td height="40" bgcolor="#CCCCCC">&nbsp;
          </td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td width="500" height="200" colspan="3">&nbsp;
    </td>
 </tr>
</table>

<br><br>

<!-- The fancy rowspan way -->

<table width="500" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC"><!-- coloring the whole table instead of just the cells you want, will stop gaps forming on forwarding from Outlook -->
  <tr>
    <td width="200" height="40" bgcolor="#FFFFFF">&nbsp;
    </td>
    <td width="100"  height="80" rowspan="2" bgcolor="#4444FF">
     <img alt="" src="" width="100" height="80" style="margin: 0; border: 0; padding: 0; display: block;">
    </td>
    <td width="200" height="40" bgcolor="#FFFFFF">&nbsp;
    </td>
  </tr>
  <tr>
    <td width="200" height="40">&nbsp;
    </td>
    <td width="200" height="40">&nbsp;
    </td>
  </tr>
  <tr>
    <td width="500" height="200" colspan="3">&nbsp;
    </td>
 </tr>
</table>

Original answer:

For basic positioning:

Horizontally, use align="left|center|right", vertically use valign="top|middle|bottom"

Here is how to place an image center top of a table:

<table width="500" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
  <tr>
    <td height="500" align="center" valign="top">
      <img alt="" src="" width="100" height="100" style="margin: 0; border: 0; padding: 0; display: block;">
    </td>
  </tr>
</table> 

It is a good practice to use inline style while creating newsletter. Also outlook doesn't support margin negative property.

in your case the image is not appear center so you can use a inline style here 'style="text-align:center;"'.

<td style="text-align:center;">
<img class="top-image" src="https://cdn1.iconfinder.com/data/icons/WPZOOM_Social_Networking_Icon_Set/64/gmail.png" />
</td>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!