【问题标题】:Position and margin top negative values are not working on html email template [closed]位置和边距顶部负值不适用于 html 电子邮件模板 [关闭]
【发布时间】:2015-11-02 15:22:06
【问题描述】:
<td style="padding: 0px 30px 0px 0px;"><table border="0" cellpadding="0" cellspacing="0" width="100%">
                    <tr>
                        <td><table border="0" cellpadding="0" cellspacing="0" width="90%" bgcolor="green">
                                <tr>
                                    <td ><div>&nbsp;</div></td>
                                </tr>
                            </table></td>
                    </tr>
                    <tr>
                        <td><table border="0" cellpadding="0" cellspacing="0" width="100%">
                                <tr>
                                    <td width="" height="30px"><div style="border-left:1px solid #00f;height:50px;margin-top:-21px;">&nbsp;</div></td>
                                    <td width="50%" height="30px"><div style="border-right:1px solid #00f;height:50px;margin-top:-21px;">&nbsp;</div></td>
                                    <td width="100%" height="30px"><div style="border-right:1px solid #00f;height:50px;margin-top:-21px;">&nbsp;</div></td>
                                </tr>
                            </table></td>
                    </tr>
                </table></td>

【问题讨论】:

标签: css html html-email email-validation


【解决方案1】:

尽管这个问题很可怕,但答案如下:

您不能通过任何基于 CSS 的方法重新定位表格单元格。此外,您无法控制表格单元格的overflow 或height(它们从不溢出,它们将始终包装其全部内容)。

您也不能将元素绝对定位在表格单元格内。这是不可能的。

在td 内的div 上使用否定的margin-top 不会有任何效果,除非div 有任何其他前面的 元素邻居。例如,如果您在 div 内部的 div 之前有一个 h1,则可以在 div 上使用 margin-top: -10px; 将 div 移动到更接近 h1 视觉上。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-06-01
    • 1970-01-01
    • 2016-10-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-12-18
    相关资源
    最近更新 更多