2016-08-03 129 views
3
<body bgcolor="#f6f6f6" style="background:#f6f6f6; border:0; color:#9e9e9e; margin:0; padding:0;"> 
<table cellpadding="0" cellspacing="0" border="0" align="center" width="100%" bgcolor="#f6f6f6" style="table-layout: fixed; margin: 0 auto; background:#f6f6f6;"> 
    <tr> 
     <td width="100%" valign="top"> 
      <table cellpadding="0" cellspacing="0" bgcolor="#f6f6f6" border="0" align="center" width="600" class="fullWidth"> 
       <tr> 
        <td><img src="spacer.gif" width="100%" height="30" alt="" /></td> 
       </tr> 
      </table> 
      <!-- More tables with content --> 
     </td> 
    </tr> 
</table> 
</body> 

我已经做了大量的测试和研究。我相信我正确地做到了这一点,但是当我去测试它时,希望表格在雅虎中居中,而不是!雅虎表中心对齐

该修复应该是把表格布局:固定;在100%宽度的外表上。

我已经完成了。

因此,任何人都可以发现我在这里做错了什么,不做这项工作?

干杯

回答

1

下面的代码应该修复它。您的电子邮件代码只需要更多CSS重置。

<html> 
    <head> 
     <style> 
      /* What it does: Fixes webkit padding issue. Fix for Yahoo mail table alignment bug. Applies table-layout to the first 2 tables then removes for anything nested deeper. */ 
      table { 
       border-spacing: 0 !important; 
       border-collapse: collapse !important; 
       table-layout: fixed !important; 
       margin: 0 auto !important; 
      } 
      table table table { 
       table-layout: auto; 
      } 
     </style> 
    </head> 
    <body bgcolor="#f6f6f6" style="background:#f6f6f6; border:0; color:#9e9e9e; margin:0; padding:0;"> 
     <center style="width: 100%; background: #f6f6f6;"> 

      <!-- Your Email Code Begins Here --> 
      <table cellpadding="0" cellspacing="0" border="0" align="center" width="100%" bgcolor="#f6f6f6" style="table-layout: fixed; margin: 0 auto; background:#f6f6f6;"> 
       <tr> 
        <td width="100%" valign="top"> 
         <table cellpadding="0" cellspacing="0" bgcolor="#f6f6f6" border="0" align="center" width="600" class="fullWidth"> 
          <tr> 
           <td><img src="spacer.gif" width="100%" height="30" alt="" /></td> 
          </tr> 
         </table> 
         <!-- More tables with content --> 
        </td> 
       </tr> 
      </table> 
      <!-- Your Email Code Ends Here --> 

     </center> 
    </body> 
</html> 
+0

上述方法可行,或者您可以将第一个​​标签添加到align =“center”中,该标签包装了内容表。关键是雅虎忽略表格上的对齐参数,它只关注​​标签中的内容。 –