<!DOCTYPE html>
<html lang="en" xmlns="https://www.w3.org/1999/xhtml" xmlns:o="urn:schemas-microsoft-com:office:office">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="x-apple-disable-message-reformatting">
<title></title>
<!--[if mso]>
<style>
table {border-collapse:collapse;border-spacing:0;border:none;margin:0;}
div, td {padding:0;}
div {margin:0 !important;}
</style>
<noscript>
<xml>
<o:OfficeDocumentSettings>
<o:PixelsPerInch>96</o:PixelsPerInch>
</o:OfficeDocumentSettings>
</xml>
</noscript>
<![endif]-->
<style>
table, td, div, h1, p {
font-family: Arial, sans-serif;
}
</style>
</head>
<body style="margin:0;padding:0;word-spacing:normal;background-color:#939297;">
<div role="article" aria-roledescription="email" lang="en" style="text-size-adjust:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;background-color:#939297;">
[Scaffold goes here]
</div>
</body>
</html>
This HTML code is a skeleton for an email template designed to be compatible with Microsoft Outlook (which often requires special handling for rendering). Let me explain the commented-out parts:
<!--[if mso]>
<style>
table {border-collapse:collapse;border-spacing:0;border:none;margin:0;}
div, td {padding:0;}
div {margin:0 !important;}
</style>
<noscript>
<xml>
<o:OfficeDocumentSettings>
<o:PixelsPerInch>96</o:PixelsPerInch>
</o:OfficeDocumentSettings>
</xml>
</noscript>
<![endif]-->
-
<!--[if mso]>
and<![endif]-->
:- These are conditional comments for Microsoft Office-specific environments, such as Outlook.
- They ensure that the code inside them is only read and applied by Microsoft Office products.
-
<style>
Block:- This block defines CSS rules specifically for Microsoft Outlook:
table {border-collapse:collapse;}
: Ensures that table borders collapse properly, which can prevent rendering issues in Outlook.div, td {padding:0;}
: Removes any padding applied todiv
ortd
elements by default.div {margin:0 !important;}
: Overrides any default or inherited margins fordiv
elements.
- This block defines CSS rules specifically for Microsoft Outlook:
-
<noscript>
and<xml>
:- These tags embed Office-specific settings in the email:
<o:OfficeDocumentSettings>
: A namespace used for Office settings.<o:PixelsPerInch>96</o:PixelsPerInch>
: Sets the pixel density to 96 DPI, which is a standard for web rendering. It ensures consistent sizing of elements in Outlook, especially for images.
- These tags embed Office-specific settings in the email:
Microsoft Outlook uses the Microsoft Word rendering engine for emails, which is notoriously inconsistent with standard HTML/CSS. These special instructions ensure proper rendering in such environments without affecting other email clients.
- The email might display improperly in Microsoft Outlook (e.g., incorrect table alignment, padding, margins, or element sizes).
- Other email clients would remain unaffected since these rules are ignored outside the
<!--[if mso]>
block.
This setup is a common practice when designing responsive, cross-client email templates.