【发布时间】:2021-10-22 13:52:25
【问题描述】:
我不能使用 div,因为这是用于 HTML 电子邮件的。我想并排放置多个不同高度的桌子,但是下面的一张桌子不会占用上面的可用空间。我正在尝试使用<table> 来实现这一点:
但我得到的是这个:
这是我目前的代码:
<style>
.textCenter {
text-align: center;
}
</style>
<body>
<table width="48.5%" style="float:left">
<tr>
<td id="td1" class="textCenter">
</td>
</tr>
</table>
<table width="3%" height="20px" style="float:left">
<tr width="100%">
<td width="100%"></td>
</tr>
</table>
<table width="48.5%">
<tr>
<td id="td2" class="textCenter">
</td>
</tr>
</table>
<table width="48.5%" style="float:left; top:20%">
<tr>
<td id="td3" class="textCenter">
</td>
</tr>
</table>
<table width="3%" height="20px" style="float:left">
<tr width="100%">
<td width="100%"></td>
</tr>
</table>
<table width="48.5%" style="float:left">
<tr>
<td id="t4" width="44%" class="textCenter">
</td>
</tr>
</table>
</body>
【问题讨论】:
-
你有6张桌子,但图片有4张?
-
你为什么不能使用
div的?电子邮件模板支持它们。为 2 列创建 2 个包装 div,并使用 float 或 ìnline-block` 将它们彼此相邻放置。 -
额外的 2 个表格无关紧要,仅用于边距(因为我不想将边距 css 用于 HTML 电子邮件。)
标签: javascript html css html-email css-tables