CSS Email styling not working with Outlook

211 Views Asked by At

I have a very simple inline css style that works fine everywhere but Outlook (browser version).

I found this compatibility website and according to it, things should work fine.

Code:

<footer style="font-size: 9px;text-align: center;">
  <p>
   /.../
  </p>
</footer>

Is there a way to achieve this result also with Outlook?
I Couldn't find, but anyone know if there is a preview for email styling?

1

There are 1 best solutions below

2
Md. Rakibul Islam On

Use table and write the styles inline in the table cell(td) like below and it will work in Outlook.

Many tags and CSS rules don't work for emails but work fine for webpages and emails when checked in browser.

<!DOCTYPE html>
<html lang="en">
 <head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>Email</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>

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

  <!-- using footer -->
  <footer style="font-size: 9px;text-align: center;">
    <p>
     This is inside the footer
    </p>
  </footer>
  
  <!-- using table -->
  <table border="0" cellpadding="0" cellspacing="0" width="100%">
    <tr>
      <td>
        <table align="center" border="0" cellpadding="0" cellspacing="0" width="600" style="border-collapse: collapse;">
          <tr>
            <td style="font-size: 9px;text-align: center;">
              This is inside the table
            </td>
          </tr>          
        </table>
      </td>
    </tr>
  </table>
</body>
</html>