Skip to content

Instantly share code, notes, and snippets.

@kvann
Last active January 5, 2022 23:56
Show Gist options
  • Save kvann/505d65f843fdc590983b to your computer and use it in GitHub Desktop.
Save kvann/505d65f843fdc590983b to your computer and use it in GitHub Desktop.
This is a very basic, strip down email template for centering your email on all email services, including Outlook desktop, Outlook.com, Gmail, and Yahoo Mail. Note -- we set max-width: 600px; this fixes the readability issue in Gmail app for Android as the app does not support media query. This template does not use the ghost table method.
<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
<head>
<meta http–equiv="content-type" content="text/html; charset=utf-8" />
<meta http–equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body style="margin: 0px; background-color: #F2F2F2; width: 100%; text-align: center;" marginwidth="0" marginheight="0">
<div style="margin: 0px; outline: none; padding: 0px; color: #5D5D5D; font-family: arial; line-height: 1.1; width: 100%; background-color: #F2F2F2; background: #F2F2F2; text-align: center;">
<table border="0" cellpadding="0" cellspacing="0" width="100%" align="left" style="min-width:100%; mso-table-lspace: 0pt; mso-table-rspace: 0pt; background-color: #F2F2F2; background: #F2F2F2;">
<tr>
<td align="center" valign="top" width="100%">
<table border="0" cellpadding="0" cellspacing="0" width="600" bgcolor="#FFFFFF" style="min-width:100%; max-width:600px; mso-table-lspace: 0pt; mso-table-rspace: 0pt;">
<tr>
<td valign="top" align="center">
<table cellpadding="0" cellspacing="0" border="0" width="600" style="min-width:100%; max-width:600px; mso-table-lspace: 0pt; mso-table-rspace: 0pt;">
<tr>
<td valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="0" style="max-width:600px; mso-table-lspace: 0pt; mso-table-rspace: 0pt;">
<tr>
<td valign="top">
<!-- The table containing your content goes here -->
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="max-width:600px; mso-table-lspace: 0pt; mso-table-rspace: 0pt;">
<tr>
<td align="left" valign="top" width="600" style="padding:20px; font-family:arial,sans; color: #5D5D5D; font-size:14px; line-height: 140%; line-height: 1.4; text-align:center;">
Your text goes here
</td>
<td align="left" valign="top" width="600" style="padding:20px; font-family:arial,sans; color: #5D5D5D; font-size:14px; line-height: 140%; line-height: 1.4; text-align:center;">
Your text goes here
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</body>
</html>
@kvann
Copy link
Author

kvann commented Jul 11, 2016

Revision #5
Set min-width to fix Android alignment issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment