Home > front end >  Outlook Desktop App ignores margin 0 and padding 0
Outlook Desktop App ignores margin 0 and padding 0

Time:02-23

I am making a e-mail with HTML and CSS. On most of the e-mail clients it works fine but the Outlook Desktop App (I use Windows) ignores the margin: 0 and padding: 0. I have declared it this way with CSS:

*{
 margin: 0;
 padding: 0;
}

And I can't find the solution for this.

CodePudding user response:

As a general rule assume email clients only look at inline styling. Style tags in the header will be ignored.

This is one of the aspects that makes crafting consistent HTML emails particularly tedious. The other bad one being the need to nest tables to make them mobile responsive.

CodePudding user response:

Not all e-mail clients accept all forms of CSS selectors. Have a look at this CSS Support Guide for Email Clients to check which clients accept which CSS selectors.

As an alternative, you could add padding to an inline element (for example, the body tag):

<body style="padding: 0;">
</body>

However, Outlook Desktop does not accept 'margin', unfortunately. Here is a list of all the CSS that Outlook does not accept.

  • Related