Site icon Email Uplers

A Complete Guide to Create Your Own HTML Email

Create Your Own HTML Email

[This post has been updated on 24th May, 2022]

Development of an HTML email code is almost like metamorphosis of a tadpole into frog. It undergoes so many changes right from the conceptualization to the final delivery of the HTML email template. Once the email marketer determines the purpose of sending an email, the copywriter drafts the email copy according to the wireframe. Subsequently, the email designer works on the email design according to the wireframe. After the design gets approved, it is assigned to the email developer who transforms the PSD or AI or PDF file into a pixel perfect HTML email. This file is loaded in the ESP and deployed after thorough testing for flawless rendering. Most of the marketers send HTML email rather than a plain text email because of its enhanced aesthetics.

As a number of people are involved in the creation of an email HTML, even a minor change can take too long to ger resolved. In fact, it roughly takes 4-6 hours to develop an email template. The intricacies of the process add to the time taken in developing a single HTML email template. Of course, you can create free HTML email from the options available online but custom-made emails perform better than those free templates.

Email Coding Can Be Cumbersome

Our team of 150+ experts can help with email templates that are

  • Hand-coded
  • Responsive
  • Pixel-perfect

Through this article, we will show you how to create simple HTML email template, which you can refer to for basic troubleshooting of your email template HTML code.

P.S: You can create free HTML email on the DIY editors, but it is always better to rely on experts like Email Uplers to ensure that your subscribers get an awesome and perfectly coded email.
We strongly recommend not to edit an HTML email on Microsoft FrontPage, Word, or Publisher as it will add an additional code to your email template. Use the basic text editor like Notepad or edit the email template HTML code in the code editor of your ESP.

Table of Content:

HTML Basics: How to Create Simple HTML Email Template?

A basic HTML email template includes two parts:

  1. Header section: Any code placed between <head> and </head> is referred to as the header section. All the media queries, styling and CSS animations are specified in this section.
  2. Body: Any code placed between <body> and </body> is the body section and the rendering engine uses the code to create HTML email structure.

Step 1: How to Prepare your HTML <head> template?

The head section of a simple HTML email template resembles the following code:

<!DOCTYPE> is used to inform the rendering engine which HTML tags to expect and which set of rules the HTML and CSS adhere to. Even though some email clients (webmail clients like Gmail, Google Apps, Yahoo! Mail and strip away the code and apply their own, it is a good practice to include this in your email template HTML code.

Even though you are free to choose between XHTML 1.0, Transitional XHTML 1.0, and Strict HTML5, most email developers worth their salt use Transitional XHTML 1.0.

<meta http-equiv=”Content-Type” /> specifies how to process text and special characters in your email. The “text/html” instructs the rendering engine to consider the following strings of text as HTML.

<meta name=”viewport” /> instructs the device, on which the email is viewed, to set the viewable area of the email as per the screen width.

The title of the email is written between the <title> tag. When a subscriber clicks on “view online”, the title of the email is displayed on the browser tab.

Step 2: How to Style Your Email HTML?

Styling is cool, but its difficult.

Whatever styling you are going to implement in your email such as text formatting, image size, media queries go between the <style> tags as different classes. The basic format for adding <style> tag is <style type=”text/css”> where in “text/css” specifies the media type as CSS. Placement of the <style> tag is tricky as 6 out of 36 email clients do not support <style> tag in <head> and Gmail doesn’t support it in the email body.

Text formatting

In case you need to add a centralized formatting condition (shown below) for any text, you can specify the attributes in the specific class of the basic HTML email template.

e.g. in order to disable text decoration in hyperlinks, add

Media Queries

In case you are coding a responsive email template, the media queries need to be added in the following format.

For example, consider the following media query in the email HTML code:

When the HTML email design is viewed in a device that is between the screen width of 481 and 699px:

P.S: !important forces the rendering engine to not make any alterations to the media query.

To create responsive HTML email example, separate media queries are specified to be activated at screen widths lesser than 480px.

The media queries you have learned till now will render in a few mobile layouts. But rendering in some of the layouts require a specific set of media queries, and only an expert developer can help you do that. You can learn more about the challenges and opportunities of responsive email template in this blog.

Interactivity in email
In case you wish to send HTML email example with interactive features, the CSS part of the code is to be added before you close the <head> section.

Interactivity in HTML emails is hard to code and requires a lot of testing to render perfectly in email clients. There might be email HTML code available on the internet, but it still requires a lot of coding experience to build interactive emails. You can learn more about interactive HTML emails in our infographic – Interactive Email Design Elements. Here, you will also be able to download samples of each interactive element that can be added in HTML email template code.

Want us to create awesome interactive emails for you? click here now>>

Step 3: What does the Final <head> code look like?

So, our final <head> in the HTML email template code looks like

Is </head> giving you a headache?
We can be your painkiller. Talk to us now.

Step 4: How to build your Email <body>?

The 600px range for HTML email design was calculated for Windows Outlook working on a 1024px desktop monitor, 10 years ago. Now devices with screen widths of minimum 800px are flooding the market; so you can build HTML emails with a width of 700px at least, and add background colors to emulate widescreen emails.

So, we start with a body of 100% width with color #efefefef.

In this we add a table that is center aligned at 700px in the HTML email design.

Now, we will include a pre-header text and “view online” as a part of a cell, made by nesting another table in the above-mentioned table.

Now, we add the hero image in the HTML email format.

Now, we add a separate table for the email copy:

Now, we add a CAN-SPAM compatible footer in the HTML email code:

Now, before we close the HTML email body, we add the following code:

This adds extra spacing to force the desktop layout in Gmail

So, your final email template HTML code should be:

There you go! You’ve successfully created an HTML Email! You can use this HTML Email Example and create your own.

Desktop Version

Mobile View

Points to Remember While Creating HTML Emails

Creating HTML emails is technique-sensitive subject as you have to bear in mind many dos and don’ts to ensure flawless rendering across different email clients and devices.

1. Avoid using JavaScript and complex CSS coding

Website developers heavily rely on JavaScript for interactivity and visual richness. However, email clients do not support JavaScript in the HTML email format. If you still want to incorporate interactivity in HTML email code, you can use AMP in HTML emails. Currently, AMP components in email are supported by Gmail, Yahoo!, and

Sometimes, you can experiment with CSS3 and HTML5 in your HTML marketing emails but make sure you test the HTML email design with its complicated coding before hitting the “Send” button.

2. Make use of font stacks

While converting email to HTML, pay attention to the fonts used. Write an HTML email with proper font stacks, thereby ensuring proper readability and rendering across different email clients.

While creating HTML emails, use email-safe fonts like Arial, Times New Roman, and Courier New. Provide fallback fonts in your HTML email design regardless whether you choose web-safe fonts or not. It is always advisable to do so as all email clients do not have the same support for fonts.

How to create a font stack in the HTML code for email template?

Font stack is a strategic compilation of fonts according to their priority in the HTML email format. You must place the font you want to use in your HTML email body at the top. Mention the email-safe alternatives and default font below that.

3. Monitor the loading time of the HTML email template code

If your email takes too long to load, it will turn off the subscribers and affect the performance of your HTML marketing emails. Therefore, you must use images and visual elements judiciously in your HTML email examples. When you build HTML email, make sure you do not add too many high-quality images. For every new image loaded in the HTML email body, a new request is generated to the server. Your loading time is directly proportional to the number of requests. So, how to design visually rich HTML email free from any rendering issues? The answer is to optimize your image size and set the content width to 600px. Also, add suitable alt-text with the images when you code HTML for email.

Use HTML minifier to remove unnecessary code from the HTML email format. Do not copy-paste from Microsoft Word when you code email to HTML. It will add too many additional codes.

4. Pay special attention to accessibility in the HTML code for email template

If you want to write an HTML email that reaches to all subscribers, you must follow accessibility best practices. When you convert PSD email to HTML, choose the visuals, font size, color contrast, and CTA button size in such a way that everyone can access it. Send HTML email with proper lang attributes and semantic tags so that screen readers can interpret the email HTML formatting. Arrange the HTML email template code from left to right and top to bottom for better readability. Single column layouts are the best bet to create accessible HTML email examples.

Wrapping Up

With the help of this step-by-step guide, you can build an HTML email template that can be used for your email marketing strategy. The above methodology is just one of the many processes used to train our developers and test the email templates rigorously using tools like Email on Acid to deliver pixel perfect results as per our clients’ requirements. You can easily use this HTML Email code to create Mailchimp Email Templates, Pardot Email Templates, Marketo, Salesforce Email Templates and many other ESP newsletter templates as well.

Ideally, being an email marketer you need to dabble into various aspects of email, including email design, email coding and template testing. At the same time, most brands and agencies partner with us for their email template production needs to deliver high converting email marketing campaigns.

Exit mobile version