Ad – 728Γ—90
πŸ› οΈ Projects

HTML Email Template Project – Marketing Email with Tables

HTML emails are unlike web pages. Email clients like Outlook, Gmail, and Apple Mail strip external stylesheets, ignore many CSS properties, and render HTML differently from browsers. The solution: table-based layouts and inline CSS β€” a technique that looks archaic but is the only reliable approach for cross-client email compatibility. This project builds a complete welcome email template from scratch.

⏱️ 18 min read🎯 BeginnerπŸ“… Updated 2026

Why Email HTML Is Different

Web browserEmail client
External CSS files workExternal CSS stripped β€” use inline CSS only
Flexbox and Grid workFlexbox and Grid poorly supported β€” use tables
Background images work everywhereOutlook ignores CSS background-image
Web fonts workLimited support β€” always include system font fallbacks
JavaScript worksJavaScript completely blocked in all email clients
Responsive CSS worksMedia queries work in some clients but not Outlook
ℹ️
The email client compatibility challenge

Outlook (used by millions of corporate users) renders HTML using Microsoft Word's rendering engine β€” not a web engine. This means many modern CSS properties simply don't work. Gmail strips <style> tags in some contexts. Testing in Litmus or Email on Acid is standard industry practice for professional email development.

Email Template Structure

We build a "Welcome to ylearner" onboarding email with these sections:

  1. Outer wrapper (background colour, centres everything)
  2. Container table (max-width 600px)
  3. Header row β€” brand colour background, logo/name
  4. Body row β€” personalised greeting, what to do next, feature highlights
  5. CTA button row β€” primary action
  6. Footer row β€” unsubscribe link, company address
Ad – 336Γ—280

Complete Email Template

HTML – Full email template
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Welcome to ylearner!</title>
  <!--[if mso]>
  <noscript>
    <xml>
      <o:OfficeDocumentSettings>
        <o:PixelsPerInch>96</o:PixelsPerInch>
      </o:OfficeDocumentSettings>
    </xml>
  </noscript>
  <![endif]-->
</head>
<body style="margin:0; padding:0; background-color:#f4f4f4; font-family:Arial, Helvetica, sans-serif;">

  <!-- Outer wrapper table β€” fills email client window -->
  <table width="100%" cellpadding="0" cellspacing="0" border="0"
         style="background-color:#f4f4f4; padding:20px 0;">
    <tr>
      <td align="center">

        <!-- Container table β€” max 600px, the email body -->
        <table width="600" cellpadding="0" cellspacing="0" border="0"
               style="max-width:600px; width:100%; background-color:#ffffff;
                      border-radius:8px; overflow:hidden;
                      box-shadow:0 2px 8px rgba(0,0,0,0.08);">

          <!-- ======= HEADER ======= -->
          <tr>
            <td align="center"
                style="background-color:#E44D26; padding:30px 40px;">
              <h1 style="margin:0; color:#ffffff; font-size:28px;
                          font-weight:700; letter-spacing:-0.5px;">
                ylearner
              </h1>
              <p style="margin:6px 0 0; color:rgba(255,255,255,0.85);
                        font-size:14px;">
                Learn to code for free
              </p>
            </td>
          </tr>

          <!-- ======= GREETING ======= -->
          <tr>
            <td style="padding:40px 40px 20px;">
              <h2 style="margin:0 0 12px; color:#1e293b; font-size:22px;">
                Welcome, Jane! πŸŽ‰
              </h2>
              <p style="margin:0; color:#475569; font-size:16px;
                        line-height:1.6;">
                Your ylearner account is ready. You now have free access to
                <strong>180+ lessons</strong> across Python, JavaScript, HTML,
                and OWL JS β€” with more added every week.
              </p>
            </td>
          </tr>

          <!-- ======= FEATURE LIST ======= -->
          <tr>
            <td style="padding:0 40px 30px;">
              <p style="margin:0 0 16px; color:#1e293b; font-size:16px;
                        font-weight:600;">
                Here&apos;s what to do next:
              </p>

              <table width="100%" cellpadding="0" cellspacing="0" border="0">
                <tr>
                  <td style="padding:8px 0; color:#475569; font-size:15px;">
                    &#10003;&nbsp; Pick your first course below
                  </td>
                </tr>
                <tr>
                  <td style="padding:8px 0; color:#475569; font-size:15px;">
                    &#10003;&nbsp; Read the first lesson β€” takes under 10 minutes
                  </td>
                </tr>
                <tr>
                  <td style="padding:8px 0; color:#475569; font-size:15px;">
                    &#10003;&nbsp; Code along with every example
                  </td>
                </tr>
                <tr>
                  <td style="padding:8px 0; color:#475569; font-size:15px;">
                    &#10003;&nbsp; Build real projects to grow your portfolio
                  </td>
                </tr>
              </table>
            </td>
          </tr>

          <!-- ======= CTA BUTTON ======= -->
          <tr>
            <td align="center" style="padding:0 40px 40px;">
              <!--[if mso]>
              <v:roundrect xmlns:v="urn:schemas-microsoft-com:vml"
                           href="https://ylearner.org"
                           style="height:50px; width:220px; v-text-anchor:middle;"
                           arcsize="10%" fillcolor="#E44D26" strokecolor="#E44D26">
                <w:anchorlock/>
                <center style="color:#ffffff; font-family:Arial; font-size:16px;
                                font-weight:700;">
                  Start Learning Now &rarr;
                </center>
              </v:roundrect>
              <![endif]-->
              <!--[if !mso]><!-->
              <a href="https://ylearner.org"
                 style="display:inline-block; background-color:#E44D26;
                        color:#ffffff; font-size:16px; font-weight:700;
                        text-decoration:none; padding:14px 36px;
                        border-radius:6px; font-family:Arial, sans-serif;">
                Start Learning Now &rarr;
              </a>
              <!--<![endif]-->
            </td>
          </tr>

          <!-- ======= DIVIDER ======= -->
          <tr>
            <td style="padding:0 40px;">
              <hr style="border:none; border-top:1px solid #e2e8f0; margin:0;">
            </td>
          </tr>

          <!-- ======= COURSES ROW ======= -->
          <tr>
            <td style="padding:30px 40px;">
              <p style="margin:0 0 16px; color:#1e293b; font-size:15px;
                        font-weight:600;">Available courses:</p>
              <table width="100%" cellpadding="0" cellspacing="8" border="0">
                <tr>
                  <td width="50%" style="background:#fff7ed; border-radius:6px;
                      padding:14px; text-align:center;">
                    <span style="font-size:24px;">🌐</span><br>
                    <strong style="color:#E44D26;">HTML</strong><br>
                    <span style="font-size:12px; color:#64748b;">Foundation of web</span>
                  </td>
                  <td width="50%" style="background:#fefce8; border-radius:6px;
                      padding:14px; text-align:center;">
                    <span style="font-size:24px;">⚑</span><br>
                    <strong style="color:#ca8a04;">JavaScript</strong><br>
                    <span style="font-size:12px; color:#64748b;">Language of the web</span>
                  </td>
                </tr>
                <tr>
                  <td width="50%" style="background:#f0fdf4; border-radius:6px;
                      padding:14px; text-align:center;">
                    <span style="font-size:24px;">🐍</span><br>
                    <strong style="color:#16a34a;">Python</strong><br>
                    <span style="font-size:12px; color:#64748b;">AI, data, automation</span>
                  </td>
                  <td width="50%" style="background:#faf5ff; border-radius:6px;
                      padding:14px; text-align:center;">
                    <span style="font-size:24px;">πŸ¦‰</span><br>
                    <strong style="color:#714B67;">OWL JS</strong><br>
                    <span style="font-size:12px; color:#64748b;">Odoo development</span>
                  </td>
                </tr>
              </table>
            </td>
          </tr>

          <!-- ======= FOOTER ======= -->
          <tr>
            <td align="center"
                style="background-color:#f8fafc; padding:24px 40px;
                       border-top:1px solid #e2e8f0;">
              <p style="margin:0 0 8px; color:#94a3b8; font-size:12px;">
                &copy; 2026 ylearner &mdash; Algorid Limited
              </p>
              <p style="margin:0; color:#94a3b8; font-size:12px;">
                You received this because you created an account at ylearner.org.<br>
                <a href="https://ylearner.org/unsubscribe?email=jane@example.com"
                   style="color:#E44D26; text-decoration:underline;">
                  Unsubscribe
                </a>
                &nbsp;&middot;&nbsp;
                <a href="https://ylearner.org/privacy-policy.html"
                   style="color:#E44D26; text-decoration:underline;">
                  Privacy Policy
                </a>
              </p>
            </td>
          </tr>

        </table>
        <!-- End container table -->

      </td>
    </tr>
  </table>
  <!-- End outer wrapper -->

</body>
</html>

Key Techniques Explained

TechniqueWhy needed
Outer wrapper table at 100% widthFills the email client window and centres the 600px container
Inner container at max 600pxStandard email width β€” renders well on desktop and mobile
All CSS inline on each elementGmail and some clients strip <style> blocks
VML button for OutlookOutlook ignores CSS on <a> β€” VML vector shapes render correctly
Conditional comments <!--[if mso]-->Targets Outlook specifically for VML fallbacks
Arial/Helvetica font stackSystem fonts guaranteed to work in every email client
cellpadding="0" cellspacing="0"Removes default table spacing that breaks pixel-perfect layouts
HTML entities (&copy;, &mdash;)Special characters rendered consistently across clients
πŸ’‘
Test your emails before sending

Litmus (litmus.com) and Email on Acid let you preview your email template across 100+ email clients and devices before sending. Many professional email tools (Mailchimp, Klaviyo, Campaign Monitor) also have built-in preview tools. Never send an email campaign without testing in at least Gmail, Apple Mail, and Outlook.

πŸ“‹ Summary

  • HTML emails require table-based layout β€” Flexbox/Grid are not reliable in email clients.
  • All CSS must be inline β€” external stylesheets and <style> blocks are stripped by some clients.
  • Use a 600px maximum width container β€” the standard safe width for email.
  • Outlook requires VML for styled buttons β€” use conditional comments to target it.
  • Always include system font fallbacks (Arial, Helvetica) β€” web fonts don't load reliably in email.
  • Add <!DOCTYPE html>, charset, and the X-UA-Compatible meta for Outlook.
  • Test in real email clients before sending β€” use Litmus or Email on Acid.

FAQ

Can I use CSS Grid or Flexbox in emails? +

No β€” not reliably. Outlook (which uses the Word rendering engine) does not support Flexbox or Grid. For cross-client compatibility you must use HTML tables for layout. Some modern email clients (Apple Mail, Gmail in browser) do support Flexbox and Grid, but since Outlook is used by a large portion of business users, tables remain the safe choice.

What width should email templates be? +

600px is the industry standard. It fits comfortably on desktop email clients without horizontal scrolling, and scales down on mobile. Some modern templates use 680px. Never go above 700px β€” wide templates look broken on many desktop clients.

Why use VML for Outlook buttons? +

Outlook ignores background-color, padding, and border-radius on <a> tags β€” making CSS-styled buttons display as plain text links. VML (Vector Markup Language) is a Microsoft format supported by the Word rendering engine in Outlook. By wrapping a VML shape in Outlook conditional comments, you get a proper styled button in Outlook while other clients see the normal CSS button.