【问题标题】:How to create a two column email newsletter如何创建两栏电子邮件通讯
【发布时间】:2013-12-14 07:35:34
【问题描述】:

我正在尝试创建一个两栏式电子邮件传单,但由于 Outlook 讨厌 CSS,我在编码方面遇到了问题。

我使用表格来使其尽可能简单,但我想要左右两个单独的表格,以便我可以根据需要向其中添加数据。

我尝试在两张表上左右使用float,但 Outlook 忽略了这种样式。

我知道底部的两个灰色表格分别位于各自独立的“持有人”表格中,但这样我可以在添加新文章时复制灰色“数据”表格。

<table class="all" width="auto" height="auto" border="0" cellspacing="0"><tr><td height="504">

<table width="750" height="140" border="0" cellspacing="0">
  <tr>
    <td width="200" valign="bottom" bgcolor="#E6E6E6">&nbsp;</td>

    <td width="345" align="center" valign="bottom" bgcolor="#E6E6E6">&nbsp;</td>
    <td width="152" align="center" valign="bottom" bgcolor="#E6E6E6">&nbsp;</td>
    <td width="45" align="center" valign="bottom" bgcolor="#E6E6E6">&nbsp;</td>
  </tr>
  <tr>
    <td width="200" valign="bottom" bgcolor="#E6E6E6">&nbsp;</td>
    <td align="center" valign="bottom" bgcolor="#E6E6E6"><font color="#111111" face="Arial Narrow" size="+2">DECEMBER NEWSLETTER</font></td>
    <td width="152" align="center" valign="bottom" bgcolor="#E6E6E6"><font size="2"><strong>#4 - <span class="orange">04.12.13</span></strong></font></td>
    <td width="45" align="center" valign="bottom" bgcolor="#E6E6E6">&nbsp;</td>
  </tr>
</table>

<table width="750" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="75" height="50" bgcolor="#E6E6E6" scope="row">&nbsp;</td>
    <td width="600" rowspan="2" scope="row"><img src="http://placehold.it/600x200"/></td>
    <td width="75" bgcolor="#E6E6E6" scope="row">&nbsp;</td>
  </tr>
  <tr>
    <td width="75" height="81" scope="row">&nbsp;</td>
    <td scope="row">&nbsp;</td>
  </tr>
</table>


<table class="holder" width="750" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td valign="top" scope="row">

    <table class="inlinetableleft" width="360">
        <tr>
          <td width="371" align="left">    

<!------------LEFT COLUMN------------------>        

<table width="360" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <th height="103" colspan="4" align="left" valign="middle" bgcolor="#CCCCCC" scope="row">&nbsp;</th>
  </tr>
  </table>    

<!--------------LEFT COLUMN END------------->      

</td>
</tr>
</table>
<table class="inlinetableright" width="360">
<tr>
  <td align="left">    

<!------------RIGHT COLUMN------------------>                   

<table width="360" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="106" align="left" bgcolor="#CCCCCC" scope="row">&nbsp;</td>
  </tr>
  </table>       

<!-----------RIGHT COLUMN END-------------->       

</td></tr>
</table>


    </td>
  </tr>
</table>

到目前为止,这是我的时事通讯的一个小技巧,它是我想并排的底部两个灰色表格。

Fiddle

【问题讨论】:

  • 我的宽度和高度没有问题。这只是让我的时事通讯在没有float 的情况下工作的一个例子

标签: outlook html-table html-email


【解决方案1】:

对于 HTML 电子邮件,嵌套表格是您的朋友 :)

JSFiddle

注意:表格周围的边框只是为了显示表格的位置。

<table border="0" width="600" cellpadding="0" cellspacing="0" align="center">
    <tr>
        <td colspan="2">
            header content here
        </td>
    </tr>
    <tr>
        <td width="300">

            <table border="0" width="300" cellpadding="1" cellspacing="0" align="left">
                <tr>
                    <td>Left Content</td>
                </tr>
            </table>



        </td>
        <td width="300">

            <table border="0" width="300" cellpadding="1" cellspacing="0" align="left">
                <tr>
                    <td>Right content</td>
                </tr>
            </table>

        </td>
    </tr>
</table>

【讨论】:

  • 这很好用,除了如果我在左列中添加更多数据,右列会垂直保持在左列旁边的中间。我希望右列保持在顶部,即使我用数据填充左侧。
  • 哦,是的,然后你需要在&lt;td&gt; 标签上使用valign="top"。将内容垂直对齐到顶部。
  • 我刚刚将valign="top" 添加到两个&lt;td&gt; 标签中,但没有任何效果。
  • 它应该在&lt;td&gt; 宽度上,当前设置在300 的宽度,而不是嵌套表内的宽度。所以&lt;td width="300" valign="top"&gt; 应该这样做。 jsfiddle.net/fRp6X
  • 谢谢!我将valign="top" 添加为内联css。我不知道你可以直接将valign="top" 添加到 td :)
猜你喜欢
  • 1970-01-01
  • 2014-02-11
  • 2014-07-01
  • 2013-06-11
  • 1970-01-01
  • 2011-07-13
  • 1970-01-01
  • 1970-01-01
  • 2019-07-06
相关资源
最近更新 更多