This page provides some common typography patterns for email.
It’s safe and accessible to use semantic HTML tags like <h>, <p>, and <ul> for text in email just as we do for the web. The main difference in email is that CSS should be written inline to specify intended styles (like the color of an anchor tag) and zero out unintended defaults (like the margin around a <p> tag).
Paragraphs
A lead paragraph with slightly larger text lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras nisi magna, mollis luctus sapien varius, mattis ornare est.
A regular paragraph with strong and italic text, consectetur adipiscing elit. Cras nisi magna, mollis luctus sapien varius, mattis ornare est. Sed non tincidunt erat, ut commodo augue.
A paragraph with no margin (useful for the last paragraph in a section).
If email content is written in Markdown, we can’t write inline CSS into link tags. Left unstyled, links will appear like this. To style links contained in Markdown text, add a class="has-markdown" to any parent tag that might contain a Markdown link.
Some email clients auto-detect certain text strings (like dates, times, and locations) and automatically convert them into hyperlinks. We can’t remove the link, but we can make the link appear like the text around it by negating a few CSS styles.
On Thursday we’ll be doing on planned maintenance on our New York server, so the parts of the site might be unavailable.
On Thursday we’ll be doing on planned maintenance on our New York server, so the parts of the site might be unavailable.
Note: Using class="unstyle-auto-detected-links" applies styles defined in the <style> tag. Only email clients that support <style> in <head> will render has-markdown links properly.
Known Issue: in Windows Outlook 2003 - 2019, preformatted code blocks appear like this.
Blockquotes
Write a function that takes a string consisting of alphabetic characters as input argument and returns True if the string is a palindrome. A palindrome is a string which is the same backward or forward.
Known Issue: in Windows Outlook 2003 - 2019, blockquotes appear like this.
Preventing text wrapping
A non-breaking space ( ) can be used to prevent a group of words from breaking onto multiple lines. Useful for keeping names together and preventing typographic orphans and widows.
Inspect the line above to see ☝️
Now with Stack Overflow you can level up.
The last sentence shouldn’t produce an orphan.
Also works for text written in markdown.
Web fonts
Sometimes we use web fonts in emails to match the aesthetic of a marketing campaign or announcement. Web fonts don’t have great support in email clients, so here’s how we ensure our web font displays in as many email clients as possible:
Include an external stylesheet at the top of the email’s <head> tag. Sites like Google Fonts provide this code.
Windows Outlook sometimes chokes on web font references and defaults everything to Times New Roman. To avoid this, wrap the web font reference in a <!--[if !mso]> tag (so Windows Outlook ignores it) and define a fallback font for Windows Outlook inside a <!--[if mso]> tag.
Lastly, reference the web font at the beginning of the font stack, followed by a system fallback font for email clients that can’t display (and ignore) the web font.
I’m a Headline
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.