Sub topic 8
Setting Preview Text in HTML Email
This chapter assumes you can read basic HTML and have sent email through a tool that lets you edit the HTML source. You should already know that preview text is the snippet shown after the subject line in the inbox.
How email clients choose preview text
Most email clients build the preview from the first text they find in the body of the HTML. If you do nothing, they take whatever comes first. That is often "View this email in your browser" or a logo's alt text, which wastes the space.
The fix is a preheader. A preheader is a block of text placed first in the body and hidden from the visible layout. Clients still read it for the preview, but readers never see it in the opened email.
A working preheader
Place this block directly after the opening <body> tag, before any header, logo or navigation.
<body>
<div style="display:none;max-height:0;overflow:hidden;opacity:0;mso-hide:all;">
Free shipping on orders over $50 applies at checkout.
‌ ‌ ‌ ‌ ‌ ‌
</div>
<!-- visible email content follows -->
</body>Each part has a job:
| Part | Purpose |
|---|---|
| `display:none` | Hides the block in clients that honor it |
| `max-height:0` and `overflow:hidden` | Collapse the block in clients that ignore `display:none` |
| `opacity:0` | Makes any remaining trace invisible |
| `mso-hide:all` | Hides the block in Outlook desktop, which uses Word to render HTML |
| ` ‌` pairs | Fill the rest of the preview line (see below) |
Stopping body text from leaking
Clients show a fixed number of characters, often somewhere between 40 and 140 depending on client and device. If your preheader is shorter than that, the client keeps reading and appends the next text it finds, such as "Hi Sam, thanks for..." or a link label. The result is a preview like "Free shipping on orders over $50 applies at checkout. View in browser Shop now".
The padding characters solve this. is a non-breaking space and ‌ is a zero-width non-joiner. Alternating them creates a run of characters that look like nothing. The client counts them toward its limit, so the visible body text falls beyond the cutoff.
Keep the real message in the first 40 to 90 characters, because narrow mobile clients cut earlier than desktop ones. Treat the padding as a guard, not a guarantee. Some clients trim whitespace, so always test.
Setting it in your sending tool
Many email platforms have a dedicated "preview text" or "preheader" field. When you fill it in, the platform inserts a hidden block like the one above. Check two things:
- Open the HTML source of a test send and confirm the block is the first element in
<body>. - Confirm the platform does not also add a "View in browser" line above it.
If your tool has no such field, paste the block into your template by hand and replace the sentence for each send.
Common errors
- Preheader placed after the header or logo. The client reads the earlier text first. Move the block to the top of the body.
- Repeating the subject line. The preview then adds no information. Write a second fact, as covered in the pairing chapter.
- Leaving the template's default text. Phrases like "Having trouble viewing this email?" appear in the preview of every send.
- Skipping real-client tests. Rendering varies. Send test messages to at least one Gmail, one Apple Mail and one Outlook account and look at the inbox list, not only the opened email.
- Using images for the message. Image-only emails give the client no text, so it shows alt text or nothing.
Exercise
Your preview in the inbox reads "Free shipping on orders over $50 applies at checkout. Hi Sam, welcome back to..." even though you have a hidden preheader. What is happening, and what do you change?
Show answer
The preheader is shorter than the client's preview length, so the client continues into the visible body text ("Hi Sam, welcome back to..."). Add padding after the preheader sentence, for example alternating and ‌ characters inside the same hidden div, then send a test to real inboxes to confirm the body text no longer shows.
Exercise
Why does the hidden div use both display:none and max-height:0;overflow:hidden, and which property targets Outlook desktop?
Show answer
Some clients ignore display:none, so the max-height and overflow rules collapse the block as a fallback. The mso-hide:all property targets Outlook desktop, which renders HTML with Word's engine.