html-email-best-practices.mdx 2.6 KB

1234567891011121314151617181920212223242526
  1. ---
  2. title: How to create an HTML email
  3. seoTitle: 10 most important rules you should keep in mind when coding HTML emails
  4. description: Do you want to code your own HTML emails? Find out the most important rules you need to take into account, so that your emails display correctly and look attractive.
  5. imageTitle: HTML email best practices
  6. imageEmail: progress
  7. summary: Designing and coding an attractive and mobile-ready HTML email message might seem like a difficult task. In fact, it doesn’t have to be, as long as you remember about a few basic rules. Assuming that you are familiar with the basics of HTML and CSS, we’ve put the rules together. Following them will make your work much easier and the results will speak for themselves. Read the article to find out more.
  8. image: https://images.unsplash.com/photo-1603791452906-af1740e171bc?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1216&h=400&q=80
  9. date: 2022-09-05 00:00:00
  10. done: true
  11. ---
  12. <GuideImage src="/img/tabler-emails/screenshots/progress-full.png" width={480} height={645} description={`Sample email you can find in the Tabler Emails package`}/>
  13. 1. Use an HTML table. Don’t use divs and floats. Tables will help you create emails that will look good in every email client.
  14. 2. Use HTML attributes to define the dimensions and the design of the table (width, valign and padding).
  15. 3. Don’t use embedded styles. Instead, use inline CSS in your HTML code.
  16. 4. Avoid Shorthand CSS (`#000`).
  17. 5. Avoid Flash and JavaScript.
  18. 6. Try to avoid HTML5 and CSS3.
  19. 7. The width of an email shouldn’t be more than `600px`.
  20. 8. Use of email-safe fonts. ([Here is the list](https://templates.mailchimp.com/design/typography)). If you use custom fonts, e.g. Google Fonts ([https://fonts.google.com](https://fonts.google.com)), set a fallback font, to be sure that everything will display correctly no matter what.
  21. 9. Use absolute addresses for images.
  22. 10. Keep the email file size under `100kb`.
  23. Sticking to the rules above is an absolute must-do if you want to code attractive HTML emails. However, it’s equally (or even more) important to test them across as many email clients and devices, as possible. Also, don’t forget that these days, most users open email messages on their mobile phones, so they must be mobile-optimized. If you create your own templates, we’d recommend applying Litmus to test them. If you prefer to use ready-made email templates that have been thoroughly tested and mobile-optimized, take a look at [Tabler Emails](https://tabler.io/emails), where you can find over <EmailsCount /> responsive and customizable templates.