How to remove default padding/margin from around the email view of outlook for HTML emails

China☆狼群 提交于 2019-12-10 13:16:56

问题


I'm having some trouble finding away to remove the padding or margin default values from around my html email in most versions of outlook. I was wondering if there is something that I can put into my HTML email to prevent the padding/margin from showing.

Thanks


回答1:


This works:

<body style="margin: 0px; padding: 0px; background-color: #252525" bgcolor="#252525">

Just note whatever you set the body background color to will bleed into the email chain if it is forwarded. I'd suggest leaving the body white and setting the color on a html container table to prevent this.




回答2:


Also if you need for your table cells to be completely flat without padding and empty make sure to add this to the table:

    <table cellpadding="0" cellspacing="0">

And in the case of the empty cells

    <td style="font-size:0px;">



回答3:


Try using the CSS reset from the HTML Boilerplate:

body{width:100% !important; -webkit-text-size-adjust:100%; -ms-text-size-adjust:100%; margin:0; padding:0;}
.ExternalClass {width:100%;}

Or better yet, just use the Boilerplate as the starting point for your e-mails.




回答4:


You can add inline styles, that override Outlook's defaults (they have higher precedence).

Eg.

<div style="padding:0; margin:0;" class="wrapper">
  ... etc ...
</div>


来源:https://stackoverflow.com/questions/15568005/how-to-remove-default-padding-margin-from-around-the-email-view-of-outlook-for-h

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!