2013-04-23 109 views
0

我遇到一个有点令人沮丧的问题,没有真正的办法找到解决端窗的...HTML表扩展在电子邮件

我编码的HTML电子邮件,我有一个特别的表一直扩展到浏览器的最后。我所测试过的所有东西(所有浏览器,Yahoo,Gmail,Outlook Mac 2011)都没有做过这种事。我收到了一个收件人的截图,虽然这非常失败。我不知道我该怎么去修复这一切时,我尝试在看起来不错...

错误:

正确:

由于你可以在屏幕截图中看到,中心列正在扩展,尽可能在它旁边的两列之间。在正确的屏幕截图中,您将看到它应该如何显示。

如果有人能给我某种方向,将不胜感激。

<!--Container--> 
<table cellpadding="0px" cellspacing="0px" width="600px" style="margin:0px auto;border:0px;border-spacing:0px;border-collapse:collapse;display:block;background-color:#1a223e;"> 
    <tr> 
      <td style="vertical-align:top;"> 

<!--Left Column--> 
<table width="227px" cellpadding="0px" cellspacing="0px" style="border:0px;border-spacing:0px;border-collapse:collapse;margin:0px auto;display:block;padding:0px;"> 
          <tr> 
            <td><a href="http://pesgm13.org/index1.asp?camp=TDGMEM2" style="border:0px;"><img src="left_image.jpg" width="227" height="932" style="display:block;border:0px;border-spacing:0px;border-collapse:collapse;vertical-align:top;background-color:#1a223e;" /></a></td> 
          </tr> 
        </table> 
      </td> 




    <td style="vertical-align:top;"> 

      <!--Content--> 
      <table width="340px" cellpadding="0px" cellspacing="0px" style="border:0px;border-spacing:0px;border-collapse:collapse;margin:0px auto;display:block;vertical-align:top;font-family:Arial, Helvetica, sans-serif;font-size:14px;line-height:16px;font-weight:normal;color:#1a1a1a;background-color:#ffffff;"> 
          <tr> 
            <td style="vertical-align:top;display:block;"> 

            <img src="headline.jpg" width="271" height="85" style="display:block;margin:0px auto;border:0px;border-spacing:0px;border-collapse:collapse;background-color:#ffffff;margin-bottom:20px;padding-top:25px;" /> 

回答

0

当使用过时的widthheight属性,而不是CSS,你需要坚持自己的语义。这些属性可以是数字值,也可以是像素,也可以是一个百分比,后面跟着%作为值。所以:

<table width="600">  <!-- correct --> 
<table width="60%">  <!-- correct -->  
<table width="600px"> <!-- invalid attribute value! --> 

大多数HTML渲染器并不是真正的迂腐,但它会显示你的客户端发现一个是。我很确定将其更改为width="600"将解决您的问题。

实际上,你可以看到在错误截图,这是解决方案,因为它也忽略了你的cellspacing声明,拖欠他们回1正常价值,因为他们拥有包括px。请注意,即使在CSS中,这也被认为是不好的形式 - 0根本没有尺寸,因此没有单位可以测量它,所以在CSS中,您也应该始终写0而不是0px,0em0%

0

当你编码电子邮件模板总是喜欢设置<td width="600"> instead of <table width="600">set width for each <td>这将是好的,让我知道,如果它不工作