2011-04-04 50 views
4

我只是創建一些電子郵件通訊,我無法弄清楚強制展望如何正確顯示我的HTML表格。展望2010年和HTML表格

有簡單的例子:

<table cellpadding="0" cellspacing="0" id="outlookHack" 
    style="table-layout:fixed; border: 0; background-color: #1E6C9D; 
      background-image: url(http://www.komix.cz/upload/img_bg.png); 
      background-repeat: repeat-y; margin-top: 0px; margin-bottom: 0px; 
      padding: 0px; margin-left: auto; margin-right: auto; 
      text-align: center;width: 620px;" width="620"> 
<tr> 
    <td width="10" style="width: 10px; background:inherit;" height="10">&nbsp;</td> 
    <td width="600" style="width: 600px; background:ihnerit;" height="10"></td> 
    <td width="10" style="width: 10px; background:inherit;" height="10">&nbsp;</td> 
<tr> 
<tr> 
    <td width="10" style="width: 10px; background: inherit;">&nbsp;</td> 
    <td width="600" style="width: 600px; background: white;">some content...</td> 
    <td width="10" style="width: 10px; background: inherit;">&nbsp;</td> 
<tr> 
</table> 

的問題是,左,右列應該有固定的10px的大小,但前景07/10使他們爲+/- 5像素。

回答

3

KISS - 保持簡單(笨)

的Outlook 07-本使用Word的渲染引擎,這基本上是IE(其是啞)進一步簡單化。它迫使你編碼回到html 1標準,並且確實限制你可以做的事情。對於初學者,基本上放棄複雜的CSS。它可以使用(內聯),但其中大部分不起作用。看到這document on compatibility

因此,使用兼容性圖表,後臺支持幾乎不存在....失去它。背景重複不受支持,並且填充也沒有得到很好的支持。

現在,如何解決你的填充問題?您可以使用cellpadding來增加空間,但有時會對不需要填充的區域產生不良影響。有些人使用嵌套表來提供必要的填充,使用外部來控制頁面佈局和內部表來控制段落。請注意,根據文檔也支持邊距,因此您可以在段落上使用邊距,將10像素左側和右側的列放棄,以支持具有10像素邊距的段落。

另外請注意,你應該避免任何速記CSS,即border:1px solid #000

謝謝,微軟。當你將UI開發人員逼瘋到你的渲染引擎質量和基本標準的普遍迴避時,你也讓我們獲得了很多額外的錢。

+0

除Outlook 07外,填充實際上在每個主要的電子郵件客戶端(包括Web和桌面)中都可以100%地工作。而Outlook 07仍然支持它,它只是可以有一些古怪的行爲 - 描述在這裏:http://www.activecampaign.com/blog/email-design-watch-your-table-cell-padding/ 對於OP目的(在水平邊上填充的直列布局),填充方法將完美工作。 – Todd 2011-04-04 16:54:09