【问题标题】:HTML Email - How do you remove -webkit-margin-before: 1em; -webkit-margin-after: 1em; which is automatically added to <p> in outlook.com (hotmail)?HTML 电子邮件 - 如何删除 -webkit-margin-before: 1em; -webkit-margin-after:1em;哪个会自动添加到outlook.com(hotmail)中的<p>?
【发布时间】:2016-06-25 03:38:47
【问题描述】:

我尝试在&lt;p&gt; 上添加以下内容作为内联样式,但outlook.com/hotmail.com 将其删除并在&lt;p&gt; 之前和之后添加1em 边距。

margin-before:0!important;
 -webkit-margin-before:0!important;
 margin-after:0!important;
 -webkit-margin-after:0!important

【问题讨论】:

    标签: html html-email hotmail outlook.com


    【解决方案1】:

    试试这个:

    <p style="Margin-top:0;Margin-bottom:0;"></p>
    

    由于某些未知原因,Outlook.com 会去除边距,除非您使用大写字母 M。

    【讨论】:

    • 谢谢。这对我有用。我将段落设置为 Padding: 0!important;边距:0!重要
    【解决方案2】:

    我想说最简单的解决方案是不使用p 标签。只需将您的副本放在td 中,然后照常应用所有内联样式。让您可以更好地控制内容,并避免与来自客户端/浏览器的默认添加样式作斗争

    【讨论】:

    • 谢谢。这可能是比使用 style="Margin: 0!important; Padding: 0!important;" 更合理和永久的解决方案
    • 我同意:第一选择是不使用&lt;p&gt; 标签,但如果你不能避免它(例如,你不能改变的导入标记)大写的“M”应该缩放很好。
    【解决方案3】:

    只需将margin: 0; 添加到&lt;p&gt; 即可覆盖它们 您可能可以将!important 添加到margin

    【讨论】:

    • 那行不通。 Outlook 去掉边距,然后添加: p { display: block; -webkit-margin-before:1em; -webkit-margin-after:1em; -webkit-margin-start:0px; -webkit-margin-end:0px; }
    • 您是否尝试过这些:&lt;p style="margin: 0 !important;"&gt;&lt;/p&gt;?添加将覆盖 margin? 的样式
    • 是的。我试过:

    • @ynot 你能把你的完整代码贴出来让我看看吗?
    • 您希望 margin 的内容为 0 对吗?我在这里找到了导致&lt;p&gt; 之间存在差距的问题。尝试删除它们之间的&lt;br&gt;,您可以获得所需的输出。
    猜你喜欢
    • 1970-01-01
    • 2011-08-29
    • 2020-01-28
    • 2012-12-21
    • 2013-02-16
    • 2011-02-03
    • 2011-08-08
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多