开发者

Getting Outlook to respect margin-top: 0px on body of an email?

I have a minor question:开发者_StackOverflow

Im doing a email that is being sent out and wish to have no margin at the top of the email - so that a image or table is flush with the top of the viewport.

I have tried sticking body tags in the html email with margin-top: 0px and it works fine in Thunderbird. However when testing in Microsoft Outlook there is a margin top applied to the content. Is there any way to get rid of this margin or is it not possible in Outlook.


You need to add the following to the <body> tag.

<body topmargin="0">

Ultimately though Outlook is poor at rendering CSS and it's going to get worse with 2010 unfortunately. In the mean time, in-line styles are really the only styles that will work in the majority of cases.


Outlook is the bane of HTML emails everywhere.

Check out this discussion for some answers and tips.

Bottom line: code like it's 1998. Tables all over the place. Don't nest tables either, as that often causes problems. No external styles, so learn to love your inline style attributes.

Ugh, just thinking about it gives me a tummyache.


Maybe you could try to insert some css that overrules the body? Something like this:

*{
  margin: 0px;
  padding: 0px;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜