Tag: email marketing

  • Reader mode: Pagination in mobile emails

    Development of responsive design make reading emails on mobile devices easier. On the other hand, the side effect is the fact that to read the massive letters now you need a lot of scrolling. As a result, to the end of the message get only the most persistent readers. If you give people the ability to quickly navigate through email, it would greatly improve the situation.

    The described technique works only in the email application Mail for iPhone (Android version in development).

    Reader mode

    The described technique allows the user to independently control the content of the letter –  with a special button letter transforms in version for reading divided into several pages that can be accessed with a click.

    Activation

    A button to enable “reader mode” is wrapped in a label that switches the checkbox with the id of the cell navigation. To display items in this mode, use the pseudo-class :checked, the menu in the top of the panel is set to position:fixed:

    
    <style>
    
    .toolbar-container{
    
    position:fixed;
    
    top:0px; left:0px;
    
    display:none;
    
    ...
    
    }
    
     
    
    #navbox:checked ~ .toolbar-container{
    
    display:block!important;
    
    }
    
     
    
    #navbox:checked ~ .articles-container{
    
    height:100%;
    
    overflow:hidden;
    
    position:fixed;
    
    top:50px;
    
    left:0px;
    
    }
    
    </style>
    
    
     
    
    <input id="navbox" type="checkbox">
    
    <label for="navbox" >Activate Reader Mode</label>
    
     
    
    <div class="toolbar-container">...hidden toolbar content ... <div>
    
    <div class="articles-container">
    
    article1, article2, article3...
    
    </div>
    

    Pagination of articles

    Article wrapped in two containers. When activated the selector :checked, outer container displays the content on the full width and height of the visible area of the screen. The outer container is also set at a fixed value at the top of email messages minus the space occupied by the menu.

    The inner container occupies the width of the visible area multiplied by the number of articles. Articles also occupy a width in the viewport and shifted to the left. This allows you to organize them in a horizontal position, displaying one article at a time.

    Then you create a radio-element for each article, when the selector :checked is set in a certain radio-element, the inner container is shifted left or right by the number of “width crane” (vw) of each article. Adding a transition allows for the “sliding effect” while browsing articles:

    
    #navbox:checked ~ #a1radio:checked ~ .articles-cont .articles{  left:0px;}#navbox:checked ~ #a2radio:checked ~ .articles-cont .articles{  left:-100vw;}#navbox:checked ~ #a3radio:checked ~ .articles-cont .articles{  left:-200vw;}
    

    The value of vw does not work on Android, so you’ll have to arrange the articles one above the other and show the right, hiding or changing its z-index.

    Moving on articles

    To navigate through the articles, create labels of arrows, which will be activated by clicking the appropriate radio-element. These labels are hidden by default and displayed only a couple associated with the currently visible article.

    
    <style>#navbox:checked ~ #a1radio:checked ~ .toolbar-cont .a1nav,#navbox:checked ~ #a2radio:checked ~ .toolbar-cont .a2nav,#navbox:checked ~ #a3radio:checked ~ .toolbar-cont .a3nav{  display:block;}</style> <div class="nav-arrows a1nav">   <label> </label><label for="a2radio">»</label></div><div class="nav-arrows a2nav">   <label for="a1radio">«</label><label for="a3radio">»</label></div><div class="nav-arrows a3nav">   <label for="a2radio">«</label><label> </label></div>

    Index menu of articles

    Index menu contains a list of labels associated with articles in a hidden and absolutely positioned div, and is displayed when the user clicks on a menu, use the selector :hover.

    Interesting point, often if the menu is hidden right after selecting the element, the mail client just ignores the selection. To cope with this problem you can add the transition and delay.

    Code

    To work with the code of the example you can in the builder of one of the email services. In text form it is presented under the spoiler:

    The code of the example

    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta name="viewport" content="width=device-width" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <style>
    * {
    margin:0;
    padding:0;
    font-family: "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif;
    font-size: 100%;
    line-height: 1.5;
    color:#333333;
    }
    img{
    max-width:100%;
    }
    body {
    -webkit-text-size-adjust:none;
    width: 100%!important;
    height: 100%;
    }
    h1,h2{
    margin-bottom:15px;
    line-height: 1.3;
    font-weight:300;
    }
    h1 {
    font-size: 32px;
    }
    h2 {
    font-size: 22px;
    }
    .toolbar-cont{
    max-height:none!important;
    overflow:visible!important;
    z-index:10;
    width:100%;
    position:fixed;
    top:0px;
    left:0px;
    display:none;
    height:50px;
    background-color:#eeeeee;
    border-bottom:1px solid #222222;
    }
    .toolbar{
    height:50px;
    line-height:50px;
    display:block;
    text-decoration:none;
    }
    .toolbar-menu{
    z-index:10;
    text-align:center;
    position:absolute;
    top:51px;
    overflow:hidden;
    transition: all 0.3s;
    -webkit-transition: all 0.3s;
    transform: rotateX(90deg);
    -webkit-transform: rotateX(90deg);
    transform-origin: top;
    -webkit-transform-origin: top;
    -webkit-transition-delay: 0.5s;
    transition-delay: 0.5s;
    }
    .toolbar-menu label{
    display:block;
    padding:5px 20px 5px 20px;
    }
    .toolbar:hover + .toolbar-menu{
    display:block;
    transform: rotateX(0deg);
    -webkit-transform: rotateX(0deg);
    }
    .articles-cont{
    background-color:#ffffff;
    }
    
    #navbox:checked ~ .articles-cont{
    width:100%;
    height:100%;
    overflow:hidden;
    position:fixed;
    top:50px;
    left:0px;
    }
    #navbox:checked ~ .articles-cont .articles{
    position:absolute;
    left:0px;
    width:303vw;
    transition: all 0.3s;
    -webkit-transition: all 0.3s;
    height:100%;
    }
    #navbox:checked ~ .articles-cont .articles .art{
    width:100vw;
    float:left;
    height:1000px;
    overflow:hidden;
    }
    #navbox:checked ~ .articles-cont .articles .art div{
    width:90vw;
    padding:20px 5vw 10px 5vw;
    }
    input{
    max-height:0;
    display:none;
    }
    .nav-arrows{
    float:right;
    display:none;
    }
    .nav-arrows label{
    cursor:pointer;
    display:inline-block;
    vertical-align:middle;
    text-align:center;
    height:50px;
    width:50px;
    font-size:30px;
    font-weight:bold;
    }
    #navbox:checked ~ #a1radio:checked ~ .articles-cont .articles{
    left:0px;
    }
    #navbox:checked ~ #a2radio:checked ~ .articles-cont .articles{
    left:-100vw;
    }
    #navbox:checked ~ #a3radio:checked ~ .articles-cont .articles{
    left:-200vw;
    }
    #navbox:checked ~ #a1radio:checked ~ .articles-cont .a1,
    #navbox:checked ~ #a2radio:checked ~ .articles-cont .a2,
    #navbox:checked ~ #a3radio:checked ~ .articles-cont .a3{
    height:100%;
    overflow-y:scroll;
    }
    #navbox:checked ~ #a1radio:checked ~ .toolbar-cont .a1nav,
    #navbox:checked ~ #a2radio:checked ~ .toolbar-cont .a2nav,
    #navbox:checked ~ #a3radio:checked ~ .toolbar-cont .a3nav{
    display:block;
    }
    .closer{
    display:inline-block;
    vertical-align:middle;
    text-align:center;
    height:50px;
    width:50px;
    font-size:30px;
    font-weight:bold;
    float:left;
    }
    #navbox:checked ~ .opener{
    display:none;
    }
    #navbox:checked ~ .toolbar-cont{
    display:block!important;
    }
    
    @media screen and (max-width: 480px) {
    #cbox-capable:checked ~ .opener div{
    margin:10px auto;
    background-color:#1abc9c;
    color:#ffffff;
    border-radius:5px;
    display: block !important;
    max-height:50px !important;
    line-height:50px;
    text-align:center;
    vertical-align:middle;
    }
    }
    </style>
    </head>
    <body>
    <div id="main-cont" style="padding:20px;">
    <h1>FreshInbox</h1>
    <div style="dislay:block;width:350px;margin:0px auto;max-width:100%">
    <img src="http://placehold.it/350x150">
    </div>
    <!--[if !mso 9]><!-->
    <input id="cbox-capable" type="checkbox" style="display:none!important;max-height:0;visibility:hidden;" checked>
    <input id="navbox" type="checkbox" style="display:none!important;max-height:0;visibility:hidden;">
    <label for="navbox" class="opener">
    <div style="display:none;max-height:0px;overflow:hidden;cursor:pointer">Reader Mode</div></label>
    <input id="a1radio" name="qradio" type="radio" checked style="display:none!important;max-height:0;visibility:hidden;">
    <input id="a2radio" name="qradio" type="radio" style="display:none!important;max-height:0;visibility:hidden;">
    <input id="a3radio" name="qradio" type="radio" style="display:none!important;max-height:0;visibility:hidden;">
    
    <div class="toolbar-cont" style="display:none;max-height:0px;overflow:hidden;">
    <label for="navbox" class="closer">x</label>
    <div class="nav-arrows a1nav">
    <label> </label><label for="a2radio">»</label>
    </div>
    <div class="nav-arrows a2nav">
    <label for="a1radio">«</label><label for="a3radio">»</label>
    </div>
    <div class="nav-arrows a3nav">
    <label for="a2radio">«</label><label> </label>
    </div>
    
    <a href="#" class="toolbar">Article Index...</a>
    <div class="toolbar-menu" style="text-align:left;background-color:#C8DEFA;border:1px solid #888888;font-size:15px;">
    <label for="a1radio">Yahoo! Mail Fixes Media Query Bug. Yahoo!!!</label>
    <label for="a2radio">Outlook.com and Background Images</label>
    <label for="a3radio">Gmail iOS Increases Email Font Sizes – Again</label>
    </div>
    </div>
    <!--<![endif]-->
    
    <div class="articles-cont">
    <div class="articles">
    <div class="art a1"><div>
    <h2>Yahoo! Mail Fixes Media Query Bug. Yahoo!!!</h2>
    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
    
    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
    
    <HR>
    
    </div></div>
    <div class="art a2"><div>
    <h2>Outlook.com and Background Images</h2>
    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
    
    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
    
    <HR>
    
    </div></div>
    <div class="art a3"><div>
    <h2>Gmail iOS Increases Email Font Sizes – Again</h2>
    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
    
    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
    
    <HR>
    
    </div></div>
    </div>
    </div>
    </div>
    </body>
    </html>
    <b>
    

    This text is a translation of the article “Режим читателя: Пагинация в мобильных email-письмах”  published by @lol_wat on habrahabr.ru.

    About the CleanTalk service

    CleanTalk is a cloud service to protect websites from spam bots. CleanTalk uses protection methods that are invisible to the visitors of the website. This allows you to abandon the methods of protection that require the user to prove that he is a human (captcha, question-answer etc.).

  • “Write letters”: Three techniques of a good layout of emails

    “Write letters”: Three techniques of a good layout of emails

    To the layout of letters and mailings devoted to a huge amount of tutorials. In this volume of information is very easy to get lost, and to write letters and do mailings still need. So today we have prepared material, which was collected three popular techniques for effective layout of emails, suitable for beginner web designers.

    Interactive writing

    Interactive elements dilute the monotonous text and save the reader’s time, and therefore are easy tool for creating sales letters and beautifully designed texts.

    As an example, let’s look at a simple way of creating interactive images. It consists of three steps:

    1. Create a table of one cell and set an background image that is displayed immediately after page loads.

    <table cellpadding=0 cellspacing=0 border=0><tr>
    <td width=240 background="http://.../alternate-image.jpg">
    </td></tr></table>

    2. Set the main image and “hide” it in a link with the class img-swap. This will create a hover-effect: when you hover over the background image, the main image will be in its place.

    <table cellpadding=0 cellspacing=0 border=0><tr><td width=240 background="http://../alternate-image.jpg"><a class="img-swap" href="http://../link"><img src="http://../primary-image.jpg" width="240" height="170" border="0" style="display:block;" alt="the product"></a></td></tr></table>
    

    3. Set up a command :hover and set the styles for the class img-swap.

    <style>.img-swap {  display: block;  width: 240px;  height: 170px;} .img-swap:hover img {  height: 0px;}</style>

    This version of the creation of interactive images is supported by services like: Mail, Outlook, Yahoo! and Gmail (with modifications).

    Progressive enhancement

    Progressive enhancement is a strategy involving the gradual creation of web pages – from simple to complex. First is the structure of the letter, and then to work on improving the appearance and usability.

    First, the content of email is marked up using HTML to form the structure, to build the layout. After that comes the debugging of the design by tools of CSS – sets the CSS styles improve the design and presentation of the document – here you can set background image, set font options, and so on. In the third stage apply the new capabilities of CSS3. After marking the content, and bring it in order, comes time of JavaScript that is responsible for communication with the interface and dynamic elements.

    Step-by-step work with a document allows you to track bugs and fix them on the spot, because the appearance of a single defect can affect the result of all the work. If you want to look at progressive enhancement in action, then pay attention to the example from html academy.

    Media queries

    Media query is the component of the CSS language, allowing you to select different sets of CSS styles. Sets of styles – the key to creating an attractive appearance of the document (illustrative practical example of CSS in action you will find the link).

    A media query consists of three sequential components that are configured step by step:

    • Media type – identifies the environment the application of the rules. There are such types, as all, print, screen (used for email) and speech
    • Expressions is a list of device properties describing, for example, the width and height  of the screen, the color
    • Rules of styles are used when you open a message in an environment appropriate to the type and properties in the expression

    Media queries are indispensable for optimizing the display format of emails on mobile devices. They allow you to move from a fixed design to a “floating” – the document will look good on different platforms.

    Moreover, the technology of media queries can be used for targeting of services (selection services that meet the specified criteria) and adapting to them. By analogy devices are targeted, where it is important to take into account the size of the screen. For example, the standard code for the iPhone 6 Plus is as follows:

    @media screen and (max-device-width: 414px) and (max-device-height: 776px) {    /* Insert styles here */
    

    Media queries allow you to create beautiful and, most importantly, adaptive emails that look good on any device, but you need to be prepared for the fact that many email clients do not support this technology.

    Interactive writing, progressive enhancement and media queries – it’s quite common techniques that can turn your electronic message into small works of art, moreover, they are a good basis for further development of your layout skills.

    This text is a translation of the article “«Пишите письма»: Три техники верстки хороших email’ов”  published by @mailman on habrahabr.ru.

    About the CleanTalk service

    CleanTalk is a cloud service to protect websites from spam bots. CleanTalk uses protection methods that are invisible to the visitors of the website. This allows you to abandon the methods of protection that require the user to prove that he is a human (captcha, question-answer etc.).

  • How-to: Techniques of creating interactive e-mail using CSS

    In our blog, we have already talked about how to implement pagination in a letter, but this is not the only version of interactive e-mailing. In some cases, you can create eye-catching emails using the hover-effect when the content changes when you hover over it.

    Today we present to your attention a selection of FreshInbox blog articles about how to create an interactive email.

    The first method involves three simple steps.

    Step 1: the table and background image

    First, you need to create a table that will contain one cell with the image as the background:

    
    <table style="height: 31px;" border="0" width="389" cellspacing="0" cellpadding="0">
    <tbody>
    <tr>
    <td width="240"></td>
    </tr>
    </tbody>
    </table>
    

    Step 2: link and image

    For hover- effect you need two images — one is shown initially and the other appears when you hover. The second step is to define the main image to be “wrapped” by link. Also, add to the link the class “img-swap” and apply to the image property display:block.

    
    <table cellpadding=0 cellspacing=0 border=0><tr><td width=240 background="http://../alternate-image.jpg"><a class="img-swap" href="http://../link"><img src="http://../primary-image.jpg" width="240" height="170" border="0" style="display:block;" alt="the product"></a></td></tr></table>

    Step 3: style and hover

    The final step is to add to the link styles and setting for it pseudo-class :hover, “targeted” on the image. Set the height of the image to 0px in that case, when the cursor hovers over a link, you can hide the image that the “background” image of the cell. Style display is set to :block for the link kept the width and height, even if concluded in it hidden image.

    
    <style>
    .img-swap {
    display: block;
    width: 240px;
    height: 170px;
    }
    .img-swap:hover img {
    height: 0px;
    }
    </style>
    

    This method is supported in Yahoo! Mail Outlook.com (and Outlook 2003). There is a modification for Gmail, which we have discussed in detail in a previous article.

    Click to see a surprise

    Another technique allows you to create interactive emails using the hover-effect, and for mobile users to show “surprise” after a click on the picture.

    This method is similar to the one described above but it differs in that, initially, for unsupported clients is not shown the original image, and the picture appears. This allows users with unsupported email programs not to miss the very meaning of the letters (although all the interactivity they will not be available).

    Supported clients: iOS Mail, Android 4.x Mail, Yahoo! Mail Outlook.com and Gmail.com (with described at the link above hack with attribute selectors).

    Unsupported clients: desktop, Outlook, mobile Gmail and Gmail for business

    What is the difference from the previous method

    To make it possible to display the opened image, you need to implement small changes compared to the previous version of the technique. Instead of using image-cover as overlay, and opened the pictures as a background, we need to do the opposite:

    
    <table border=1 cellpadding=0 cellspacing=0 background="http://freshinbox.com/examples/rollover-reveal-simple/images/reveal-close-l.jpg"><tr><td><a class="reveal" lang="x-reveal" style="display:block;width:500px;height:400px;"   href="#">  <img src="1450830627199316115658"   style="display:block;" height=400 width=500 alt="A surprise!" border=0></a></td></tr></table>
    

    Opened the image will be the main, and the original “cover” will become the background. Then on supported email clients, we initially hide the overlay, showing only the cover (i.e. the background). When the user hovers the cursor over the image, he has to be shown the hidden image.

    So, instead of:

    
    rollover:hover img{    max-height: 0px;    height:0px;}
    
     
    
    The code will look like this:
    
    .reveal img{max-height:0px;height:0px;}.reveal:hover img{  max-height: none;  height: auto;}
    

    Thus, if your email program does not support interactivity, the user will see the image, which eventually opens on hover. In this case, the wow-effect is lost but retained the meaning of the message.

    Besides, the image is wrapped in a “dead link” – it is necessary in order to effect triggered by tap on iOS and Android. The link may be active, but then the Android users will be redirected to it. In principle, interactivity on mobile devices you can even turn off with a special media query:

    
    @media screen and (max-device-width: 1024px){  .reveal img{    max-height: none !important;    height: auto !important;  }     }
    

    Under the spoiler presents the full code for the example (to work with it, you can on Codepen):

    This text is a translation of the article “How-to: Техники создания интерактивных email-писем с помощью CSS”  published by @lol_wat on habrahabr.ru.

    About the CleanTalk service

    CleanTalk is a cloud service to protect websites from spam bots. CleanTalk uses protection methods that are invisible to the visitors of the website. This allows you to abandon the methods of protection that require the user to prove that he is a human (captcha, question-answer etc.).

    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=EDGE" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <title>Rollover to Reveal</title>
    <!--
    This version supports mobile
    -->
    <style>
    
    /* wrapping in media query prevents styles from activating in OWA */
    .yfix{}
    
    @media screen and (max-width:9999px) {
    .reveal img{
    max-height: 0px;
    height:0px;
    }
    .reveal:hover img{
    max-height: none;
    height: auto;
    }
    
    * [lang=x-reveal] img{
    max-height: 0px;
    height:0px;
    }
    * [lang=x-reveal]:hover img{
    max-height: none;
    height: auto;
    }
    }
    
    </style>
    </head>
    <body style="margin:0px; padding:0px;">
    
    <table border=1 cellpadding=0 cellspacing=0 background="http://freshinbox.com/examples/rollover-reveal-simple/images/reveal-close-l.jpg"><tr>
    <td><a class="reveal" lang="x-reveal" style="display:block;width:500px;height:400px;" href="#"><img src="1450830627199316115658" style="display:block;" height=400 width=500 alt="A surprise!" border=0></a></td>
    </tr></table>
    
    </body>