Not like internet browsers, e mail shoppers interpret HTML of their distinctive methods, affecting the structure, performance, and look of your emails.
With this information, I goal to create a complete HTML components toolkit that can assist you optimize emails for various shoppers. Additionally, I’ll be referencing CSS, however the primary focus is on HTML.
Supported HTML tags overview
Verify the desk that includes generally used tags, together with their perform and compatibility with totally different e mail shoppers. Click on on the tags to leap to a extra detailed clarification and sensible suggestions.
HTML Tag | Operate | Gmail | Outlook | Apple Mail | Yahoo Mail | AOL | Thunderbird |
<b> | Daring textual content | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
<i> | Italic textual content | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
<ahref=””> | Hyperlink | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
<ul> | Unordered record | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
<ol> | Ordered record | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
<img> | Picture | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
<desk> | Desk structure | ✅ | Partial | ✅ | Partial | ✅ | ✅ |
<div> | Division for block-level content material | ✅ | Partial | ✅ | ✅ | ✅ | ✅ |
<span> | Inline textual content styling | ✅ | Partial | ✅ | ✅ | ✅ | ✅ |
<kind> | Kind for consumer enter | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
Universally supported HTML tags: detailed explanations
Beneath, you’ll discover the tags that kind the muse of e mail design and are dependable with most e mail shoppers. I categorized them based mostly on the perform; you’ll additionally discover tiny code snippets displaying how the tags are supposed for use.
Primary textual content formatting
Universally supported textual content formatting tags are the next.
- <b>: makes the textual content throughout the tag daring
<p>This can be a <b>daringb> assertion.p> |
- <i>: makes the textual content throughout the tag italicized
<p>That is an <i>italici> phrase.p> |
- <u>: provides an underline to the textual content throughout the tag
<p>That is an <u>underlinedu> phrase.p> |
- <p>: defines a paragraph of a textual content, vital for organizing copy into readable blocks
<p>This can be a new paragraph of textual content within the e mail.p> |
- <robust>: creates a powerful emphasis; just like <b>, however extra semantically significant
<p>This can be a <robust>robust emphasisrobust> on some extent.p> |
- <em>: just like <i>, but it surely’s used for refined emphasis; you need to use it to spotlight key phrases and phrases elegantly
<p>That is an <em>emphasisedem> phrase.p> |
Reminder: The tags above are dependable throughout Gmail, Outlook, Apple Mail, Yahoo, and different shoppers. Your styling will stay constant throughout these platforms.
Hyperlinks and anchor tags
Certain, the <a href=””> tag is universally supported, however there are some particular quirks I’d like to attract your consideration to.
- Primary utilization: outline the hyperlink with the <a href=””> tag, guaranteeing it consists of the total URL to forestall errors.
<p>Click on <a href=”https://instance.com”>right herea> to study extra.p> |
- Gmail: helps inline styling inside anchor tags, so you may customise the looks of hyperlinks with CSS (e.g., colour, text-decoration).
- Outlook: usually strips CSS types from hyperlinks, so it’s worthwhile to use the text-decoration perform immediately throughout the tag.
<a href=”https://instance.com” model=”text-decoration: underline; colour: #0000EE;”>Go to Our Web sitea> |
- Apple Mail: typically respective of styling inside <a> tags, so that you’re versatile with colours and underlines.
To emphasize, testing hyperlinks throughout totally different shoppers is crucial because the help degree might change. I’ll cowl the small print beneath the “Finest practices” part.
Ordered and unordered lists
Lists are supported throughout the board (each <ol> and <ul>), however notice that spacing and indentation might range. Listed below are fundamental examples.
<ul> <li>First merchandiseli> <li>Second merchandiseli> <li>Third merchandiseli> ul> |
<ol> <li>First merchandiseli> <li>Second merchandiseli> <li>Third merchandiseli> ol> |
Professional Tip: Outlook might generally add further areas round record gadgets. For those who use CSS padding changes with the <li> component, you may fine-tune the structure consistency.
Picture help
Once more, photos are broadly supported, however sure attributes and picture behaviors might range, significantly with Outlook and Yahoo Mail.
<img src=”https://instance.com/picture.jpg” alt=”Description of picture” width=”600″ top=”300″> |
Attributes:
- src: specifies the picture URL. Use absolute URLs, as relative paths often don’t load appropriately.
- alt: offers different textual content for accessibility; this might be invaluable in case your photos fail to load.
- width and top: outline the specific dimensions to regulate picture show and stop resizing points with Outlook.
Consumer-specific concerns:
- Outlook: It might ignore sure styling or photos. For instance, this sometimes occurs with max-width, which causes photos to seem stretched. To beat this, use the precise dimensions and keep away from relying solely on CSS for responsiveness.
- Yahoo Mail: It has restricted help for customized picture styling. That you must check the e-mail template totally, primarily if it makes use of photos with backgrounds or borders.
Tip: Hold the photographs inside a set width or depend on pixel values fairly than percentages. This helps guarantee photos render nicely with most shoppers.
HTML tags with restricted or partial help
Partially supported and restricted help tags require particular workarounds to get the consistency you’re on the lookout for. I’ll briefly cowl the essential construction, attributes, workarounds, and so on.
Tables
Despite the fact that desk renderings are frequent in e mail layouts, they will range. The discrepancies are the obvious with Gmail and Outlook. Verify the examples and tricks to retain exact management over the e-mail construction.
<desk width=”100%” cellpadding=”0″ cellspacing=”0″> <tr> <td>Row 1, Column 1td> <td>Row 1, Column 2td> tr> <tr> <td>Row 2, Column 1td> <td>Row 2, Column 2td> tr> desk> |
Attributes:
- width: outline a set width for tables to take care of constant layouts with totally different shoppers.
- cellpadding and cellspacing: ensure that to regulate each attributes or your spacing might seem off.
Consumer-specific suggestions:
- Gmail typically helps tables however might require inline CSS for padding and margin changes. Additionally, keep away from nesting tables too deeply to forestall show points.
- Outlook renders tables utilizing the Microsoft Phrase engine (a nightmare in case you ask me 😀), which frequently disregards CSS-based layouts. To get desired consistency, specify widths throughout the <td> tags and avoid superior CSS to outline positions inside tables.
Right here’s an instance of a constant desk styling:
<desk width=”100%” cellpadding=”10″ cellspacing=”0″ model=”border-collapse: collapse;”> <tr> <td model=”width: 50%; background-color: #f0f0f0;”>Column 1td> <td model=”width: 50%; background-color: #cccccc;”>Column 2td> tr> desk> |
Enter components and types
Kinds and different components are usually not broadly supported, so keep away from utilizing them immediately in your emails. However, in fact, there’s all the time a workaround; examine the small print beneath.
- Unsupported components: <kind>, <enter>, <button>, and <textarea> sometimes received’t perform in Gmail, Outlook, or Yahoo Mail.
- Workaround: Use a call-to-action hyperlink and direct customers to a touchdown web page the place they will fill out a kind.
<p>We’d love to listen to from you! <a href=”https://instance.com/suggestions” goal=”_blank”>Click on right here to go away suggestionsa>.p> |
Divs and spans
Being partially supported throughout totally different shoppers, the <div> and <span> tags are sometimes utilized in mixture with inline types to enhance compatibility. I’ll cowl the essential utilization and a few suggestions and methods (there’s actually no workaround right here).
Primary utilization:
- <div>: sometimes used for block-level components, it helps arrange totally different sections inside an e mail.
- <span>: that is an inline container usually used for styling particular textual content components.
- Inline styling: As indicated earlier, numerous e mail shoppers strip the embedded and exterior CSS, making inline styling important for these tags. ⬇️Verify the exemplary snippet on the right way to use the <div> tag.
<div model=”background-color: #f0f0f0; padding: 10px;”> This can be a div with background colour and padding. div> <p>This can be a <span model=”colour: #ff0000;”>highlightedspan> phrase.p> |
Consumer-specific suggestions:
- Outlook: it could ignore sure inline types; I recommend utilizing the <desk> component for extra complicated layouts.
- Responsive design: Gmail and Apple Mail help media queries so it’s potential to regulate <span> and <div> types for cellular units. Nevertheless, the responsiveness of such emails may be unpredictable with Outlook. To beat that, use fallback designs for complicated layouts.
Consumer-specific concerns for HTML rendering
Verify the right way to tailor your HTML for Gmail, Outlook, Apple Mail, and different generally used e mail shoppers.
Gmail
General, Gmail helps many CSS and HTML options; even so, the consumer has its quirks. Right here’s what to remember.
- CSS: Gmail helps fundamental inline CSS and a few media queries. Nevertheless, it doesn’t all the time render exterior and embedded types reliably. Subsequently, it’s finest to depend on inline types as an alternative.
- Identified Gmail rendering points:
- Picture blocking: Very often, Gmail blocks photos by default, and customers must allow them manually. Add alt textual content to <img> tags to take care of e mail accessibility when the photographs are blocked.
- Media queries: Gmail helps media queries on cellular, but it surely doesn’t help media queries in desktop apps. So apply media queries just for mobile-specific styling.
Outlook
To remind you, Outlook makes use of Microsoft Phrase’s rendering engine, which might set off surprising points. I already talked about a number of recommendations on the right way to overcome this, so this part is like an prolonged recap.
- CSS and HTML limitations: Outlook sometimes ignores CSS properties resembling margin, padding, and float. To work round this, rely closely on <desk> components for structure, cell padding and cell spacing attributes.
- Photos: If photos lack specific width and top, Outlook is more likely to show them incorrectly. So, ensure that to outline these attributes.
Right here’s an instance of code for a table-based structure with cell padding and cell spacing.
<desk width=”100%” cellpadding=”10″ cellspacing=”0″ model=”border-collapse: collapse;”> <tr> <td model=”background-color: #f0f0f0;”>Content material Space 1td> <td model=”background-color: #cccccc;”>Content material Space 2td> tr> desk> |
Fast suggestions:
- Use tables for layouts as a result of restricted CSS help.
- Keep away from complicated layouts with nested tables.
- Take a look at e mail template designs with Outlook desktop and internet variations – they might render in a different way.
Apple Mail and different shoppers
Arguably, Apple Mail has the strongest help for HTML and CSS, making it one of the crucial dependable shoppers for superior e mail design. Right here, I’ll additionally provide some suggestions and methods for Yahoo, AOL, and another shoppers.
Apple Mail:
- Helps inline and embedded CSS and media queries.
- You may render strong HTML5 components and have gradients, animations, and internet fonts.
Necessary Word: Despite the fact that Apple Mail helps it, go simple on complicated styling, internet fonts, and particularly animations. There’s a excessive likelihood different shoppers received’t help them, and so they might have an effect on e mail deliverability, not solely accessibility.
Yahoo Mail:
- Helps inline types and embedded CSS. Nevertheless, some superior properties like show: flex might not render correctly.
- Yahoo usually blocks or delays picture loading, so it’s best to embody alt textual content.
AOL and Thunderbird:
- These shoppers have HTML/CSS help just like Yahoo. However Thunderbird gives a extra dependable rendering of embedded and inline types.
- Typically, keep away from superior inline strategies. The identical goes for superior CSS layouts resembling flexbox (applies to Yahoo, AOL, and Thunderbird).
Finest practices for utilizing HTML tags in emails
Honestly, this complete article is sort of a record of finest practices. So right here, I’d wish to concentrate on testing and the Mailtrap Electronic mail Testing instrument. And I’ll additionally cowl recommendations on creating mobile-responsive designs.
Electronic mail testing throughout totally different shoppers
I’d all the time suggest a instrument that explicitly exhibits help throughout totally different e mail shoppers and provides you precise references to which traces of code is likely to be problematic.
Mailtrap Electronic mail Testing is one such instrument. It’s a part of the Mailtrap Electronic mail Supply Platform and an e mail sandbox for inspecting emails in staging, dev, and QA environments.
The vital factor is that it gives the next:
- HTML/CSS examine (with percentile consumer help and specific references to problematic traces of code)
- Electronic mail preview (internet, cellular, and desktop)
If it’s worthwhile to check rather a lot or have a number of tasks, Mailtrap Electronic mail Testing additionally gives API for QA automation, a number of testing inboxes, consumer administration, and e mail template testing by way of API.
For Mailtrap Electronic mail API/SMTP customers, API permits for a straightforward transition from testing to manufacturing necessities. You may change a number of traces of code and ship your templates as quickly as you’re certain they’re prepared for recipients.
Cellular responsiveness
Beforehand, I discussed some methods for cellular responsiveness, and on this part, I mix them and provide you with some hands-on suggestions.
- Use inline styling to outline mobile-friendly properties resembling padding, font dimension, and line top.
- You should utilize media queries to regulate structure, font dimension, and pictures for cellular screens. Nevertheless, don’t neglect that Outlook doesn’t help these, in contrast to Gmail and Apple Mail. Right here’s a fast instance.
<model> @media solely display and (max-width: 600px) { .responsive-text { font-size: 14px; padding: 10px; } } model> <p class=”responsive-text” model=”font-size: 16px; padding: 20px;”>This paragraph is styled for desktop and cellular.p> |
- A single-column structure scales nicely throughout totally different units, that’s why it’s best to use it for cellular.
- Use bigger fonts and buttons to enhance accessibility and readability on smaller screens. Additionally, thoughts the CTA hit space and their hierarchy; see the ballpark values beneath ⬇️
- Gmail: 36 x 48 pixels
- Apple Mail: 48 x 48 pixels
- Outlook: 26 x 34 pixels
Wrap-up
By now, you’re geared up with all it’s worthwhile to use HTML tags in your emails successfully. And sure, it’s a cautious stability between universally supported tags, your design, and the tags that want some intelligent workarounds.
However don’t neglect, your job doesn’t cease when you could have a extremely accessible and deliverable template. That you must hold testing and refining your strategy since e mail shoppers will hold evolving.