html - how - text align center emails




Center div in Microsoft Outlook (2)

A good reflex is to go on the official Microsoft Documentation Network: http://msdn.microsoft.com/en-us/library/aa338201.aspx

Here you can see that the best method is to use.. another thing than a div element.

Use a table, it allow the maximum of css control.

I used <div style="width: 742px; margin: 0px auto; "> to center the container div.

In the browser it works, but when I open it in Microsoft Outlook it's not in the center.

I also used !important on the margin because I thought it took precedence over the CSS.

How do I center a div in the browser and email?


For emailing in general it is better to do use html attributes and deprecated tags instead of their CSS equivalents because some messaging systems ignore inline styles.

For example, instead of:

<div style="width: 742px; margin: 0px auto; ">...

You can use:

<body align="center"><table align="center" width="742">...

Or

<div align="center">...

Example 2, instead of:

<p style="font-family: Arial, Helvetica, Tahoma, sans-serif;">My text</p>

You can do:

<font face="Arial" size="4">My text</font>




outlook