Skip to content
Tutorials Center
My learning

Topics

Lesson 133 of 139 ยท Projects

Project: Newsletter Layout

Build a responsive newsletter in three stages with table layout and inline styles, then learn why email CSS differs from web CSS and how to test it safely.

Everything you have learned in this course assumes a modern browser. An email newsletter breaks that assumption. It is opened in dozens of different programs: web mail in a browser, phone apps, and desktop clients, one of which still renders HTML with the engine of a word processor. Many of these clients ignore <link> tags, strip parts of <style>, and have never heard of Grid or custom properties.

That is why email HTML looks like the web of 2005: tables for layout, inline styles on every element, and a fixed width around 600 pixels. In this project you build a newsletter for a fictional garden shop, Fern & Fig, in that style, and then add a media query so it adapts on phones in the clients that support it.

Treat this as a tour of the constraints. Real newsletters are almost always built with a tool or framework that compiles modern markup to this kind of HTML, but you will understand what comes out of it.

The rules of email CSS

Before writing code, here are the rules that shape everything below. Client support changes over time, so test in the clients your audience actually uses.

  • Layout with tables. <table role="presentation"> is the dependable layout tool. Flexbox and Grid are not safe, and float and position are unreliable. (role="presentation" tells screen readers the table is not data.)
  • Inline styles. Put style="..." on the elements themselves. Many clients drop or rewrite <style> blocks, so a stylesheet can only be an enhancement, never the foundation. Build tools "inline" CSS for you.
  • Simple properties. Stick to widths, padding, colors, fonts, borders and background-color. Avoid calc(), custom properties, vh units and gap.
  • Padding on cells, not margins. Margins are inconsistent on many elements. Use padding on <td>.
  • Web-safe fonts. Provide a stack that ends in Arial, sans-serif or Georgia, serif. Custom fonts load only in some clients.
  • Images need width, alt and display: block. Many clients block images by default, so the alt text and a background color must still read well. display: block removes the small gap under images.
  • Absolute URLs and a plain-text version. Images and links must use full https:// URLs, and a text alternative helps both accessibility and spam filters.

Stage 1: The skeleton

The structure has an outer table that fills the width and carries the page background, and an inner table fixed at 600 pixels and centered with align="center". Each section of the newsletter is one table row.

The HTML attributes width, align and cellpadding are not "bad old habits" here. They are what makes older clients behave, so email authors use them together with CSS.

Stage 1: the table skeleton

Notice width="600" on the table plus style="width:100%;max-width:600px". Clients that understand CSS let the table shrink on small screens; older ones fall back to the fixed 600 pixels. This "fluid but capped" pattern is common in email.

Stage 2: Content blocks

Now fill in the sections. A hero image, a heading, a bulletproof button and a two-column product row.

A bulletproof button is a link styled like a button using padding on a table cell with a background color, rather than an image. It still works when images are blocked. The link itself gets display:inline-block, padding, and an explicit text color, because some clients restyle links.

For the two columns, the trick is to use two <td> cells in one row, each with a percentage width. Stage 3 will stack them on phones.

Stage 2: hero, button and two columns

Two small but important details: the footer link color is set inline (clients otherwise paint links blue on a dark background), and every email must offer a visible unsubscribe link. That is often a legal requirement as well as good manners.

Stage 3: A media query for phones

The <style> block in the <head> is where a media query lives. Clients that support it get the improved mobile layout; the others simply show the 600-pixel layout scaled or scrolled, which is still readable.

The pattern is to give the cells that should stack a class, and in the media query turn them into blocks: display: block !important; width: 100% !important;. The !important is genuinely needed here, because inline styles have higher priority than any stylesheet rule, and the only way for a stylesheet to override them is !important (!important). This is one of the rare places where it is the right tool.

Stage 3: stacking columns on small screens

The preview here is only an approximation. A web page is not an email client, so a layout that works in the editor can still break in Outlook or an older mobile app.

Testing and good habits

  • Test in real clients. Send test messages to a few accounts or use a preview service. Check at least one webmail, one phone app and one desktop client.
  • Check with images off. The alt text and the background colors should still leave a readable message.
  • Keep it light. Stay below roughly 100 KB of HTML (some clients clip long messages) and keep image files small.
  • Dark mode. Some clients invert colors automatically. Avoid pure white text on transparent images, and give logos a background or outline. The prefers-color-scheme media query works only in some clients.
  • Accessibility still matters. Use real headings and paragraphs inside the cells, descriptive link text, sufficient contrast, and lang on the <html> element.
  • Use tools for production. Email frameworks and inliners turn readable source into this style of HTML, so you don't hand-maintain nested tables.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Why do email layouts still use tables?

    Email clients vary widely, and some use limited rendering engines. Tables are the common denominator.
  2. 2. Why put styles inline instead of in a <style> block?

    A stylesheet can enhance the message (such as the phone media query), but the layout must already work with inline styles alone.
  3. 3. Why does the media query in Stage 3 need !important?

    Inline style attributes win over normal rules. !important in a stylesheet beats them.
  4. 4. What is a 'bulletproof button'?

    It relies only on text, color and padding, which every client renders, unlike an image that may be blocked.

Summary

  • Email clients differ from browsers, so newsletters use role="presentation" tables, inline styles and a 600px width.
  • Use padding on cells, web-safe fonts, display:block images with alt text and absolute URLs.
  • Fluid-but-capped tables (width:100%; max-width:600px) adapt without media queries.
  • A <style> block with a media query and !important can stack columns on phones in supporting clients.
  • Always test in real clients, include an unsubscribe link and keep the message light and accessible.

Next: Project: Meet the Team Page, where you are back in the modern browser, building a card grid with hover overlays.