Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

ClickPesa profile imageNeema Adam
Neema Adam forClickPesa

Posted on

     

Our experience in creating HTML email templates

Our experience in creating HTML email templates

Despite being a UI/UX designer, my passion has always been development so when the Getpaid team was working on the notifications part of the platform, I immediately asked the tech lead to let me work on the HTML email templates.

I remember thinking, "Hey, it's HTML, I am good with HTML, I can do it", little did I know how much of a nightmare it can be creating email templates. But I pushed through it, did a lot of research, and learned a lot of things about how to build an HTML template and what things to consider while building an HTML template.

Things to consider while building an HTML template

1. Compatibility across major email clients

According toLitmus.com, there are about 10 different email clients that share the global email client market and all these email clients support or don't support certain HTML tags and certain CSS rules.

It's important to take note of what is supported in order to create an HTML template that is compatible with all these email clients. I usedCaniemail to check the support of a tag or a CSS rule I was considering using.Campaign Monitor also provides a great guide to CSS support for the most popular mobile, web, and desktop email clients.

2. Responsiveness

A responsive email will resize and adapt to any screen size whether it is a desktop, laptop, tablet, or mobile, therefore, creating a responsive email template will ensure that the email is always readable on any device.

3. Dark/light mode

According toNighteye App, 81.9% of people use dark mode on their phones, 82.7% of survey participants said they use their operating system’s dark mode, and 64.6% of respondents expect sites to automatically apply a dark theme.

This means that even if you don't set up a dark theme, your email will still look dark on devices where users like me have set the operating system to apply dark mode to everything. So it's important to create an email template that can work well with both dark and light modes.

Implementation

When creating an email template, your usage of HTML and CSS is limited. Only table elements and inline CSS are a guarantee to work across the board of email clients and even then, not all CSS rules work in most email clients.

We decided to take our chances with the style element even though at least four email clients do not support it and the main reason for that is to include styles for dark mode and responsiveness. Here is a code snippet of our CSS code to support dark mode.

Code snippet of a CSS code to support dark mode

We experienced a bit of trouble with the background-image property, it was not showing on some email clients, even those that were supposed to support it so we decided to have a compromise on the Getpaid logo; place it using an image tag and only have the icon so the logo can be visible on both light and dark modes.

Here is a link to the fullemail template if you are interested in taking a look.

Top comments(2)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss
CollapseExpand
 
mjshofy profile image
Marjan Shofy
Front-end web developer and YouTube content creator @thecodermj (Front-end website design and development tutorial videos). @mjshofy
  • Location
    Sylhet, Bangladesh
  • Education
    Shahjalal Uposhohor High School, Sylhet, Bangladesh
  • Work
    freelance Front-end web developer
  • Joined

I have tried to create html email template's as well faced the same problems as you have mentioned! Just pain.
don't support extarnal stylesheets, can't add flex or grid. have to do with float.

CollapseExpand
 
neicore profile image
Neema Adam
your friendly neighborhood product engineer
  • Location
    Dar, Tanzania
  • Education
    Youtube
  • Pronouns
    She / Her
  • Work
    ClickPesa
  • Joined

exactly..like we are in the 90s 😅

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

Trending onDEV CommunityHot

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp