Code Monkey home page Code Monkey logo

responsive-html-email-template's Introduction

Free Responsive HTML Email Template

Sometimes all you want is a really simple responsive HTML email template with a clear call-to-action button. Here it is.

See live preview.

Simple HTML Email Template

Inline your CSS before sending

Email is notorious for inconsistent CSS support. Therefore you should always inline your CSS and send a test to yourself before sending.

Sending emails directly from your codebase or using a developer service?

For an API service (like Mailgun, SendGrid, Postmark) you need to inline the CSS before sending. See email-inlined.html for an example.

You can use this Email CSS Inliner and then send a test email to yourself to verify it works as expected.

  • Copy all of email.html
  • Paste the HTML as the source into the inliner
  • Copy the HTML output and use this as the email template you send

Sending emails using a marketing service like Mailchimp?

Use the template email.html as is. They'll put the CSS inline for you when you put together your campaign.

Images in email

When inserting images remember to include the following attributes or risk them breaking in different clients:

  • src
  • alt
  • width
  • height
  • border

Example:

<img src="https://absolute-path-to-image.jpg" alt="Useful alt text" width="500" height="300" border="0" style="border:0; outline:none; text-decoration:none; display:block;">

More information here

Tried and tested on all major email clients

Tested on mobile, desktop and web.

Tested on Email Clients

More HTML email resources

This free template is part of a pack of responsive email templates for developers and startups available on HTML Email. image

responsive-html-email-template's People

Contributors

abhishekdwaghmare2000 avatar aeonfr avatar aleksa-savic avatar axessweb avatar axzx avatar bcalik avatar crease29 avatar denzildoyle avatar devaney avatar dmyers avatar iamharsha97 avatar jarnheimer avatar jjasghar avatar joeyespo avatar jongotlin avatar karlhorky avatar kevinburke avatar koistya avatar leemunroe avatar malvoz avatar na1056 avatar simmerer avatar sonam-st avatar toolness avatar webketje avatar yaronguez avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

responsive-html-email-template's Issues

Why does <h1> force text-transform uppercase?

Is this in place because it serves as some kind of compatibility hack I'm not aware of? If not, it seems like title capitalization should be left to content producers instead of being forced by CSS.

This is especially troublesome when working with titles that have words that should begin with a lowercase letter. Examples:

  • jQueryJQuery (incorrect)
  • Have a Nice DayHave A Nice Day (incorrect)

does not render properly in Outlook 2013.

i just did a test and it does not render properly in outlook 2013. the entire column appears to the right when open in email test. It is not in the center of the screen when you open an email. It does look good in yahoo mail, iOS and so on. How can I fix it?

Image width in Outlook 365 does not behave as expected

I'm not sure if this is a bug pertaining exactly to this library but I notice that it is in the CSS so I thought I would say something.

Outlook seems to not like CSS styling of image widths/heights. My 1200px width PNG used as a heading image would display full size in outlook and would pull the rest of the container with it creating all sorts of styling issues.

For images the only way to override this behavior seems to be to put the width as the HTML parameter rather than CSS styling.

<img src=".." width="300">

Button issue with Outlook on Android

It seems there's an issue with the .btn (and/or .btn-primary) class when viewing the email in Outlook on Android.

The text does not return to white on Android's version of Outlook. Also, the bottom border-radius does not match the top.

This is using the exact code from the current email.html.

Screenshot

Outlook support

Have you tested it in Outlook?
I've tried to open template in Outlook 2010 and max-width and paddings was broken.

Centering buttons?

What is the recommended method to center a btn-primary link button? The current code uses a nested table to create the button, previously I simply used something along these lines:

<tr>
<td align="center">
    <a href="#" class="btn-primary">Link..</a>
</td>
</tr>

Desktop view missing button

Looks fine on mobile and tablet. But when opened with Firefox and MS Edge using Gmail the link shows up as plain text:

screen shot 09-05-16 at 11 42 pm

inliner

can you tell me which inliner processor you used to generate html-inlined.
I have some changes in body and your inlined version is not much readable.

Pre header text indent in Outlook 2016

Hello,

I ran across a minor formatting issue in Outlook 2016 where the preheader text was indented in the outlook message preview.

I fixed it by simply moving the pre header span above the table.

Before:

<body class="">
    <table role="presentation" border="0" cellpadding="0" cellspacing="0" class="body">
      <tr>
        <td>&nbsp;</td>
        <td class="container">
          <div class="content">

            <!-- START CENTERED WHITE CONTAINER -->
            <span class="preheader">This is preheader text. Some clients will show this text as a preview.</span>
            <table role="presentation" class="main">

After:

<body class="">
<span class="preheader">This is preheader text. Some clients will show this text as a preview.</span>
    <table role="presentation" border="0" cellpadding="0" cellspacing="0" class="body">
      <tr>
        <td>&nbsp;</td>
        <td class="container">
          <div class="content">

            <!-- START CENTERED WHITE CONTAINER -->
            <table role="presentation" class="main">

other style in gmail in browser

hello, the template is behaving strange on gmail in browser, the background is white, not gray. Is it bug or feature ? :D

Email and email inlined don't match

I am using a php library to inline the css from the html and I was comparing result.

I spotted that the inlined file in the repository doesn't keep the same structure.

Just look at the

This is preheader text. Some clients will show this text as a preview.

Just want to point it out.

Donations possible?

Thanks a lot for creating this template. It has saved me a ton of time and a bit of money (and it works like a charm!), because so far I was looking to buy a template and then integrating it into my app.

If there's a way of donating a bit to the project - buy you a coffee maybe - I'll happily do. Let me know if and how I can send you the money.

Issue on outlook

Hi,

Thanks for your template. I am juste having a problem win outlooks.
cf screeshot:http://hpics.li/3ff9ade

my code before inline text:


`<!doctype html>
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <link href="https://fonts.googleapis.com/css?family=Muli" rel="stylesheet">
    <title>Simple Transactional Email</title>
    <style>
        /* -------------------------------------
          GLOBAL RESETS
      ------------------------------------- */
        img {
            border: none;
            -ms-interpolation-mode: bicubic;
            max-width: 100%;
        }

        body {
            background-color: #f6f6f6;
            font-family: 'Century Gothic','CenturyGothic','AppleGothic','Muli', sans-serif; 
            color:#808080;
            -webkit-font-smoothing: antialiased;
            font-size: 14px;
            line-height: 1.4;
            margin: 0;
            padding: 0;
            -ms-text-size-adjust: 100%;
            -webkit-text-size-adjust: 100%;
        }

        table {
            border-collapse: separate;
            mso-table-lspace: 0pt;
            mso-table-rspace: 0pt;
            width: 100%;
        }

            table td {
                font-family: 'Century Gothic','CenturyGothic','AppleGothic','Muli', sans-serif; 
                font-size: 14px;
                vertical-align: top;
            }

        /* -------------------------------------
          BODY & CONTAINER
      ------------------------------------- */

        .body {
            background-color: #f6f6f6;
            width: 100%;
        }

        /* Set a max-width, and make it display as block so it will automatically stretch to that width, but will also shrink down on a phone or something */
        .container {
            display: block;
            Margin: 0 auto !important;
            /* makes it centered */
            max-width: 580px;
            padding: 10px;
            width: auto !important;
            width: 580px;
        }

        /* This should also be a block element, so that it will fill 100% of the .container */
        .content {
            box-sizing: border-box;
            display: block;
            Margin: 0 auto;
            max-width: 580px;
            padding: 10px;
        }

        /* -------------------------------------
          HEADER, FOOTER, MAIN
      ------------------------------------- */
        .main {
            background: #fff;
            border-radius: 3px;
            width: 100%;
        }

        .header {
            
            padding-top: 10px;
            text-align: center;
            width: 100%;
            
        }
        header .p{
            font-size:100px;
        }

        .wrapper {
            box-sizing: border-box;
            padding: 20px;
        }

        .footer {
            clear: both;
            padding-top: 10px;
            text-align: justify;
            width: 100%;
        }

            .footer td,
            .footer p,
            .footer span,
            .footer a {
                color: #999999;
                font-size: 12px;
                text-align: justify;
            }

        /* -------------------------------------
          TYPOGRAPHY
      ------------------------------------- */
        h1,
        h2,
        h3,
        h4 {
            color: #000000;
         font-family: 'Century Gothic','CenturyGothic','AppleGothic','Muli', sans-serif; 
            font-weight: 400;
            line-height: 1.4;
            margin: 0;
            Margin-bottom: 30px;
        }

        h1 {
            font-size: 35px;
            font-weight: 300;
            text-align: center;
            text-transform: capitalize;
        }

        p,
        ul,
        ol {
       font-family: 'Century Gothic','CenturyGothic','AppleGothic','Muli', sans-serif; 
            font-size: 14px;
            font-weight: normal;
            margin: 0;
            Margin-bottom: 15px;
        }

            p li,
            ul li,
            ol li {
                list-style-position: inside;
                margin-left: 5px;
            }

        a {
            color: #E41171;
            text-decoration: underline;
        }

        /* -------------------------------------
          BUTTONS
      ------------------------------------- */
        .btn {
            box-sizing: border-box;
            width: 100%;
        }

            .btn > tbody > tr > td {
                padding-bottom: 15px;
            }

            .btn table {
                width: auto;
            }

                .btn table td {
                    background-color: #ffffff;
                    border-radius: 5px;
                    text-align: center;
                }

            .btn a {
                background-color: #ffffff;
                border: solid 1px #E41171;
                border-radius: 5px;
                box-sizing: border-box;
                color: #E41171;
                cursor: pointer;
                display: inline-block;
                font-size: 14px;
                font-weight: bold;
                margin: 0;
                padding: 12px 25px;
                text-decoration: none;
                text-transform: capitalize;
            }

        .btn-primary table td {
            background-color: #E41171;
        }

        .btn-primary a {
            background-color: #E41171;
            border-color: #E41171;
            color: #ffffff;
        }

        /* -------------------------------------
          OTHER STYLES THAT MIGHT BE USEFUL
      ------------------------------------- */
        .last {
            margin-bottom: 0;
        }

        .first {
            margin-top: 0;
        }

        .align-center {
            text-align: center;
        }

        .align-right {
            text-align: right;
        }

        .align-left {
            text-align: left;
        }

        .clear {
            clear: both;
        }

        .mt0 {
            margin-top: 0;
        }

        .mb0 {
            margin-bottom: 0;
        }

        .preheader {
            color: transparent;
            display: none;
            height: 0;
            max-height: 0;
            max-width: 0;
            opacity: 0;
            overflow: hidden;
            mso-hide: all;
            visibility: hidden;
            width: 0;
        }

        .powered-by a {
            text-decoration: none;
        }

        hr {
            border: 0;
            border-bottom: 1px solid #f6f6f6;
            Margin: 20px 0;
        }

        /* -------------------------------------
          RESPONSIVE AND MOBILE FRIENDLY STYLES
      ------------------------------------- */
        @media only screen and (max-width: 620px) {
            table[class=body] h1 {
                font-size: 28px !important;
                margin-bottom: 10px !important;
            }

            table[class=body] p,
            table[class=body] ul,
            table[class=body] ol,
            table[class=body] td,
            table[class=body] span,
            table[class=body] a {
                font-size: 16px !important;
            }

            table[class=body] .wrapper,
            table[class=body] .article {
                padding: 10px !important;
            }

            table[class=body] .content {
                padding: 0 !important;
            }

            table[class=body] .container {
                padding: 0 !important;
                width: 100% !important;
            }

            table[class=body] .main {
                border-left-width: 0 !important;
                border-radius: 0 !important;
                border-right-width: 0 !important;
            }

            table[class=body] .btn table {
                width: 100% !important;
            }

            table[class=body] .btn a {
                width: 100% !important;
            }

            table[class=body] .img-responsive {
                height: auto !important;
                max-width: 100% !important;
                width: auto !important;
            }
        }

        /* -------------------------------------
          PRESERVE THESE STYLES IN THE HEAD
      ------------------------------------- */
        @media all {
            .ExternalClass {
                width: 100%;
            }

                .ExternalClass,
                .ExternalClass p,
                .ExternalClass span,
                .ExternalClass font,
                .ExternalClass td,
                .ExternalClass div {
                    line-height: 100%;
                }

            .apple-link a {
                color: inherit !important;
           font-family: 'Century Gothic','CenturyGothic','AppleGothic','Muli', sans-serif; 
                font-size: inherit !important;
                font-weight: inherit !important;
                line-height: inherit !important;
                text-decoration: none !important;
            }

            .btn-primary table td:hover {
                background-color: #34495e !important;
            }

            .btn-primary a:hover {
                background-color: #34495e !important;
                border-color: #34495e !important;
            }
        }
    </style>
</head>
<body class="">
    <table border="0" cellpadding="0" cellspacing="0" class="body">
        <tr>
            <td>&nbsp;</td>
            <td class="container">
                <div class="content">

                    <!-- START CENTERED WHITE CONTAINER -->
                    <span class="preheader">Nous aimerions votre avis.</span>
                    <table class="main">

                        <!-- START MAIN CONTENT AREA -->
                        <tr>
                            <td class="wrapper">
                                <table border="0" cellpadding="0" cellspacing="0">
                                    <tr>
                                        <td align="right" style="margin-top: 15px; padding-right:15px ">
                                <img src="es/logo.png" height="50" border="0">
                            </td>
                                    </tr>
                                    <tr >
                                        <td  class="header"><h2>Nous aimerions votre avis.</h2>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <p>Bonjour Gérard Dupont ,</p>
                                            <p>SMy blibabla blo loremipsum</p>
                                                 <br />
                                             <table border="0" cellpadding="0" cellspacing="0" class="btn btn-primary">
                                                <tbody>
                                                    <tr>
                                                        <td align="left">
                                                            <table border="0" cellpadding="0" cellspacing="0">
                                                                <tbody>
                                                                    <tr>
                                                                        <td><a href="http://htmlemail.io" target="_blank">Donnez votre avis</a> </td>
                                                                    </tr>
                                                                </tbody>
                                                            </table>
                                                        </td>
                                                    </tr>
                                                </tbody>
                                            </table>
                                         <br />
                                            <p>Numéro de ezfezf: 45412<br />
                                           Date de la xxx: 14/12/2016 <br />
                                           
                                                Nature de la demande : yyyyyy
                                            </p>
                                            <p>
                                                <p>
                                                   <strong> Mathilde</strong>
                                            
                                   <br /> Service qualité</p>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>

                        <!-- END MAIN CONTENT AREA -->
                    </table>

                    <!-- START FOOTER -->
                    <div class="footer">
                        <table border="0" cellpadding="0" cellspacing="0">
                            <tr>
                                <td class="content-block">
                                    <span class="apple-link">Ce document est susceptible de contenir des informations confidentielles dont la divulgation est rigoureusement interdite. Il est établi à la destination exclusive de son destinataire dont le nom figure ci-dessus. Si vous avez reçu ce document par erreur, merci de le détruire immédiatement et d'avertir l'expéditeur de l'erreur de distribution et de la destruction du message
                                    </span>
                                    <br>
                                </td>
                            </tr>

                        </table>
                    </div>

                    <!-- END FOOTER -->

                    <!-- END CENTERED WHITE CONTAINER -->
                </div>
            </td>
            <td>&nbsp;</td>
        </tr>
    </table>
</body>
</html>
`

Button 100% width, is this the best way?

What is the best way to make the button 100% width?

I did:

<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: separate;mso-table-lspace: 0pt;mso-table-rspace: 0pt;width: 100%;">
  <tbody>
	<tr>
	  <td style="font-family: sans-serif; font-size: 14px; vertical-align: top; background-color: #3498db; border-radius: 5px; text-align: center;"> <a href="http://htmlemail.io" target="_blank" style="display: inline-block; color: #ffffff; background-color: #3498db; border: solid 1px #3498db; border-radius: 5px; box-sizing: border-box; cursor: pointer; text-decoration: none; font-size: 14px; font-weight: bold; margin: 0; padding: 12px 25px; text-transform: capitalize; border-color: #3498db;">Call To Action</a> </td>
	</tr>
  </tbody>
</table>

(Note the width: 100% in the first

element) And it looks fine,

image

Would this have any impact on Outlook/Gmail?

Best practice images 100%?

sorry for being a bit lazy, when adding images, what style needs to be added to the img?

<img src="" width="100%; height="auto" />

?

btw, nice template thx for sharing

why font size needs to be forced?

Because of this line:

        table[class=body] a {
          font-size: 16px !important; /* why this needs to be important??? */
        }

We cant modify our fontsize in the email. Please remove that !important

Width at Outllook 2016

Hello
I'm testing the template in different mail clients.
In all programs it looks good, but not with Outlook 2016.
Shown in a narrow column and with the buttons unformatted

I do not know how to correct this
Thanks.

E-mail template not rendering correctly in Gmail web client

I have been using your email template for over a week now, and just tried it out by sending it to an Gmail email account. However, the email template does not get rendered correctly in the web client of Gmail (www.gmail.com) as you can see on the screenshot below

You can find the email (including headers) here. I am using Mailjet to get the e-mail delivered, and Laravel to send the e-mail.

7bb6b0e

Content not centered on Mac OS Mail

Hello!
First of all, thanks for your amazing work.
I am having some issues with centering on Mail on Mac (High Sierra, 10.13.4).
I'm sending the HTML inlined version, copy & paste, and the content is not centered. I have checked the source and it's the same as the original:

captura de pantalla 2018-05-21 a las 12 55 49

Any ideas?

Add Samsung Mail specific styles for phone and address

Samsung renders phone numbers and addresses as links, making them blue and underlined.

Adding this to <style> block will fix.

#MessageViewBody a {
 color: inherit;
 text-decoration: none;
 font-size: inherit;
 font-family: inherit;
 font-weight: inherit;
 line-height: inherit;
}

Unable to center button on Android Gmail App

Hello and thanks for the great work!

A bit of an issue, I'm trying to center a button, like so (tried the inlined version too):

<table border="0" cellpadding="0" cellspacing="0" class="btn btn-primary">
  <tbody>
    <tr>
      <td align="center">
        <table border="0" cellpadding="0" cellspacing="0">
          <tbody>
            <tr>
              <td>
                <a href="https://example.com/abcdef">Open link</a>
              </td>
            </tr>
          </tbody>
        </table>
      </td>
    </tr>
  </tbody>
</table>

This seems to be working mostly fine on everything I've tested, except a notable case:

On Android 7, using the Gmail app (7.11.5.177402951 if it makes a difference) and on a Xiaomi Redmi Note 4X device, the button is aligned left in portrait orientation. Interestingly, if I rotate the phone, then it is correctly center-aligned.

Any idea how to center-align the button while fitting in with the rest of the styles? Is my approach wrong? I don't think I've edited anything that might affect this. Any kind of workaround would be useful.

Head styles

hello, I just downloaded your email template. Thank creating this. Before I go and use the template isn't it a bad thing to include all your styles within the ? Many email clients like Gmail disregard these?

g.

Missing padding in Outlook

In most clients there is 10px padding between the main content area (white background) and footer (3 lines at the bottom), but in Outlook this seems to be missing. This can be seen at https://litmus.com/checklist/emails/public/d432046 with the following clients:

  • Outlook 2007 - Win 7
  • Outlook 2013 - Win 7
  • Outlook 2013 120 DPI - Win 7
  • Outlook 2016 - Win 7

Presumably this is because Outlook does not support padding on the div element (according to https://www.campaignmonitor.com/css/).

Content not centered mac os Mail when attachement

Hi there,
First of all thanks for this awesome template.

I have got a weird behaviour on mac os Mail app.

If I'm attaching an ICS file to the email, the content of the email isn't centred anymore (only the main block part).

I'm using Amazon SES to send emails from a NodeJS app using NodeMailer.
Also, the css is inlined.

screen shot 2018-10-14 at 9 06 01 pm

screen shot 2018-10-14 at 9 35 38 pm

Any idea on this one?

Thanks!

Gmail Webclient problem with provided email-inlined.html

Using your provided email-inlined.html (unmodified!) I can't get a satisfying result for Gmail Webclient. See the following screenshot. Is this a known limitation? Things not working: Not centered container, missing background color.

bildschirmfoto 2016-03-07 um 16 06 19

CSS issue?

Sorry for another issue but I was able to get things working using the django-inlinecss library you pointed out. However, when using it I found the resulting button has a table td around it that appears too big. (or the button is too small). Here's a screenshot as I hover over the buton.

screen shot 09-06-16 at 10 00 pm

When I remove

.btn-primary table td { background-color: #3498db; }

I now get:

screen shot 09-06-16 at 10 01 pm

These are both on a GoDaddy account although I see issues on mobile as well (but not as bad)

Capital M margins

This is more of a question than an issue but I was wondering why only some of the margins in the template are capital M. I understand it's best practice to use capital margins because Outlook for some reason doesn't strip out margins of there's a capital letter in the declaration. Were some of the margins left lowercase for some specific purpose or should they all be capitalized?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.