2

我为电子邮件通讯创建了两个并排放置的表格,但在 Outlook 中查看时,第二个表格位于第一个表格之下。

这是JSfiddle

HTML:

<div id="container">

<table id="table1">
    <tr>
        <th colspan="2">&nbsp;</th>
    </tr>
    <tr>
        <td height="106" colspan="2">&nbsp;</td>
    </tr>
    <tr>
        <td height="155">&nbsp;</td>
        <td>&nbsp;</td>
    </tr>
    <tr>
        <td height="114">&nbsp;</td>
        <td>&nbsp;</td>
    </tr>
</table>

<table id="table2">
    <tr>
        <th colspan="2">&nbsp;</th>
    </tr>
    <tr>
        <td colspan="2">&nbsp;</td>
    </tr>
    <tr>
        <td height="236">&nbsp;</td>
        <td>&nbsp;</td>
    </tr>
    <tr>
        <td height="118">&nbsp;</td>
        <td>&nbsp;</td>
    </tr>
</table>

</div>

CSS:

#table1, #table2 {
    border: 1px solid black;
    float: left;
    width: 350px;
}
#table2 {
    float: right
}
#container {
    width: 700px;
    margin: 0 auto;
}
4

2 回答 2

6

您可以将两个表嵌套在父表的两个单元格中。

<table class="father">
  <tr>
    <td>
        <table>...</table>
    </td>
    <td>
        <table>...</table>
    </td>
  </tr>
</table>
于 2013-08-16T09:06:34.363 回答
0

尝试这个:

table{table-layout: fixed;}

或者您将两个表都包装在一个 div 中,即container. 定义 this like 的宽度#container{width: 1200px;}

根据你的评论

容器的宽度仅定义为 700 像素,小于导致低于第一个表的两个表的宽度。因此,增加#container覆盖两个表格宽度的宽度。

于 2013-08-16T08:54:05.857 回答