Click to Sign Up for a 7 Day Free Trial!

Email Development

Outlook.com Margin-alizes CSS Properties

Email On Acid

Outlook.com and Hotmail Allow No Margins (for Error)

It's always a challenge to create emails that will look good in every client, and it may have just gotten a little bit harder. Outlook.com has discontinued support for:

margin
margin-top
margin-right
margin-bottom
margin-left

In the past, Outlook.com has not supported the margin and margin-top properties, but discontinuing all margins is new.

Enforced Styles

Hotmail and Outlook.com enforce their own embedded styles on headings and paragraphs. Then they proceed to strip yours out. Hotmail's enforced attributes look like this:

<style>
h1, h2, h3, h4, h5, h6 {
 margin: 0 0 5px 0;
}
 
p {
 margin: 0 0 1.35em 0;
}
</style>

The email client srips every instance of the margin property (server side), so unfortunately this issue plagues all web browsers.

Working Without Margins

Though it will never work in quite the same way as margin, the padding property can be used in many places where margin would have been ideal. Just remember that padding goes inside the border of an HTML element, whereas margin goes outside the border. If you find another work-around or a fix, please let us know in the comments down below!

About the Author

Geoff Phillips

Geoff Phillips

Half writer, half email builder/fixer and half customer support, Geoff is living his dream in a role that combines his many diverse interests. Code problem or tricky client got you down? Geoff's your man.

Join the Discussion

If you use a span tag instead of a p tag and set margin-top:#; margin-bottom:#; this will resolve it.
Alex
It's not just the margin properties. From what I can tell, float is out too, as is the img align attribute.
Jeff
Anyone have an issue with the margins when just writing or receiving emails. It doesn't happen with all emails.

Some of my emails I send to friends are received with what seems like a negative left margin. Parts of words and letters are cut off.

This also happens with some emails I receive. The margin seems to be negative value.
AWE
Re: Alex - you can use span, but it won't display as a block level element in Outlook 2007/10/13. (see http://stackoverflow.com/questions/8989161/how-do-i-get-ms-outlook-to-accept-the-css-style-displayblock)

If the default margins are breaking your stuff your best bet is nested tables unfortunately. Outlook is so bad it hurts
Ryan
I created a hr in my email, and want make it align to left, i use
style="text-align:left;margin-left:0", all browser are working instead of hotmail.

I am really down of it.
Man!
Rose
rose
Problem is - if you use large font sizes on paragraphs to get the appearance of a heading - something I've done in the past to avoid issues with heading tags in Hotmail, then you get proportionally huge bottom margins. Fortunately outlook.com no longer seems to make headings green!
Paul
I know the last posts were from 2013, but I encountered this problem yesterday/today. I have a heading that has both padding and margin, and in-between the two is a border to separate:

HEADING
______________

Paragraph text here...


I hadn't used <hx> tags in awhile, so forgot about lack of margin support.

Since the emails are in table-based layouts, my solution was to put the heading in its own table row and removing the margin. Then, in the next table row, I added top padding. This worked for all email clients that I tested via litmus.com and my own devices.

Hope that helps someone.
WebDevJoshB

Leave a Comment