html 中的边距在 Outlook 中不起作用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20347803/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Margin in html not working in Outlook
提问by George Viju
I am developing an email template which has the spacing as dynamic, so I made the position as margin,
我正在开发一个具有动态间距的电子邮件模板,所以我将位置设置为边距,
For Eg:
例如:
<td width="264px" bgcolor="#9ac5db" style="font-family:arial;font-size:12px;color:#000000;padding: 10px 5px 30px;" valign="top">
<div name="nltitle" id="nltitle" style="font-family:arial;font-size:14px;color:#000000;display:block;text-align:center;margin:15px 0px 15px 0px;"><b>Test App</b></div>
<hr width="100%" color="#ffffff" size="3px">
<div style="margin:10px 10px 30px 10px;text-align: left">
Test App
</div>
</td>
Here I used padding and margin for setting the spaces dynamically, but it is not working in outlook. How can I fix this issue? Any Help is highly appreciated.
在这里,我使用了填充和边距来动态设置空间,但它在 Outlook 中不起作用。我该如何解决这个问题?任何帮助都受到高度赞赏。
Cheers,
干杯,
George
乔治
回答by John
Margin is not supported in Outlook.com, so typically you should avoid it in html email design. Instead use padding or spacer table cells with
like mdesdev suggests.
Outlook.com 不支持边距,因此通常您应该在 html 电子邮件设计中避免使用它。而是使用
mdesdev 建议的填充或间隔表单元格。
A few other tips:
其他一些提示:
- You should remove the 'px' in your
width=""
declarations - Add fallback fonts as non-windows users don't have Arial
- Instead of CSS
text-align:left;
, use HTMLalign="left"
- You don't need the divs, you can use all tables
- You may have to separate your shorthand
padding
values intopadding-top
,padding-bottom
etc. From memory I think there might be issues writing them short hand in some email clients.
- 您应该删除
width=""
声明中的“px” - 添加后备字体,因为非 Windows 用户没有 Arial
text-align:left;
使用 HTML代替 CSSalign="left"
- 你不需要div,你可以使用所有表
- 您可能需要您的速记分隔
padding
值代入padding-top
,padding-bottom
从内存等,我觉得可能是写他们的手短一些电子邮件客户端的问题。
More info than you asked for, but I hope it helps...
比您要求的更多信息,但我希望它有所帮助...
回答by Jomin George Paul
the answer is simple
答案很简单
instead of this give
而不是这个给
margin:10px 10px 30px 10px;
please use this
请使用这个
Margin:10px 10px 30px 10px;
and also Mr.George using div is not a good
而且 Mr.George 使用 div 也不好