How to Properly Compose E-Mail HTML Code : 1

Similar documents
Campaign Guidelines and Best Practices

Designing HTML s for Use in the Advanced Editor

HTML TIPS FOR DESIGNING

The Essential Guide to HTML Design

Web Design Basics. Cindy Royal, Ph.D. Associate Professor Texas State University

8 STEPS TO CODE KILLER RESPONSIVE S

Creative Guidelines for s

MCH Strategic Data Best Practices Review

GUIDE TO CODE KILLER RESPONSIVE S

BlueHornet Whitepaper

The Essential Guide to HTML Design

Table of Contents THE DESIGNER S GUIDE TO CREATING NEWZAPP DRAG AND DROP TEMPLATES... 6 THE NEWZAPP SYSTEM... 7

RESPONSIVE DESIGN BY COMMUNIGATOR

ART 379 Web Design. HTML, XHTML & CSS: Introduction, 1-2

Chapter 1: Outlook Isn t Going Anywhere Chapter 2: 17 Must-Know Tricks for Outlook 2007, 2010 &

Coding HTML Tips, Tricks and Best Practices

ITNP43: HTML Lecture 4

How To Design An In Html (Html) And Html (Mailbox) Safely

{color:blue; font-size: 12px;}

Outline of CSS: Cascading Style Sheets

Development Perspective: DIV and CSS HTML layout. Web Design. Lesson 2. Development Perspective: DIV/CSS

Caldes CM12: Content Management Software Introduction v1.9

CHAPTER 10. When you complete this chapter, you will be able to:

This document will describe how you can create your own, fully responsive. drag and drop template to use in the creator.

Web Development 1 A4 Project Description Web Architecture

Best Practices in Marketing 33 Tips to Improve Your HTML Design

CSS 101. CSS CODE The code in a style sheet is made up of rules of the following types

What is CSS? Official W3C standard for controlling presentation Style sheets rely on underlying markup structure

WHITEPAPER. Skinning Guide. Let s chat Velaro info@velaro.com by Velaro

Creating, Installing & Using Signatures Technical Considerations By Rex Weston

Essential HTML & CSS for WordPress. Mark Raymond Luminys, Inc mraymond@luminys.com

CSS for Page Layout. Key Concepts

Using Style Sheets for Consistency

Advanced Web Design. Zac Van Note.

ICE: HTML, CSS, and Validation

Style & Layout in the web: CSS and Bootstrap

Web Building Blocks. Joseph Gilbert User Experience Web Developer University of Virginia Library

Basics of HTML (some repetition) Cascading Style Sheets (some repetition) Web Design

JJY s Joomla 1.5 Template Design Tutorial:

CIS 467/602-01: Data Visualization

HTML CSS Basic Structure. HTML Structure [Source Code] CSS Structure [Cascading Styles] DIV or ID Tags and Classes. The BOX MODEL

Creator Coding Guidelines Toolbox

CREATING A NEWSLETTER IN ADOBE DREAMWEAVER CS5 (step-by-step directions)

Advanced Drupal Features and Techniques

Responsive Web Design: Media Types/Media Queries/Fluid Images

White Paper Using PHP Site Assistant to create sites for mobile devices

New Perspectives on Creating Web Pages with HTML. Considerations for Text and Graphical Tables. A Graphical Table. Using Fixed-Width Fonts

Caldes CM2: Marketing s Support Document v1.12

Web Design for Programmers. Brian Hogan NAPCS Slides and content 2008 Brian P. Hogan Do not reproduce in any form without permission

HTML Tables. IT 3203 Introduction to Web Development

Microsoft Expression Web Quickstart Guide

Eloqua What is this and why should I read it?

Responsive Design

Dreamweaver CS4 Day 2 Creating a Website using Div Tags, CSS, and Templates

Web Design Revision. AQA AS-Level Computing COMP2. 39 minutes. 39 marks. Page 1 of 17

Web Design I. Spring 2009 Kevin Cole Gallaudet University

Chapter 7 Page Layout Basics Key Concepts. Copyright 2013 Terry Ann Morris, Ed.D

A quick guide to... Effective HTML Messages

Cascading Style Sheets (CSS)

Last week we talked about creating your own tags: div tags and span tags. A div tag goes around other tags, e.g.,:

Working with the new enudge responsive styles

Table of Contents Desktop PC and Apple Mac applications Web and mobile device readers Find out more about NewZapp

Introduction to XHTML. 2010, Robert K. Moniot 1

Contents. Downloading the Data Files Centering Page Elements... 6

CST 150 Web Design I CSS Review - In-Class Lab

Rhetorik campaign - Guidelines

Web Development. Owen Sacco. ICS2205/ICS2230 Web Intelligence

Website Planning Checklist

File types There are certain image file types that can be used in a web page. They are:

We automatically generate the HTML for this as seen below. Provide the above components for the teaser.txt file.

Designing HTML ers

Introduction to Web Design Curriculum Sample

HTML Fails: What No One Tells You About HTML

Looking Good! Troubleshooting Display Problems

HTML MARKETING GUIDE

How To Create A Web Page On A Windows (For Free) With A Notepad) On A Macintosh (For A Freebie) Or Macintosh Web Browser (For Cheap) On Your Computer Or Macbook (

Creating Effective HTML Campaigns

Web Design and Databases WD: Class 7: HTML and CSS Part 3

Create Your own Company s Design Theme

Web Authoring CSS. Module Descriptor

Web Design with CSS and CSS3. Dr. Jan Stelovsky

WEB DEVELOPMENT IA & IB (893 & 894)

You can use percentages for both page elements and text. Ems are used for text,

RESPONSIVE DESIGN FOR MOBILE RENDERING

Website Login Integration

Chapter 8 More on Links, Layout, and Mobile Key Concepts. Copyright 2013 Terry Ann Morris, Ed.D

Transcription:

How to Properly Compose E-Mail HTML Code : 1

For any successful business, creating and sending great looking e-mail is essential to project a professional image. With the proliferation of numerous e-mail readers it is a challenge to format each e-mail such that it looks good in all them. Here are some tips to create HTML e-mail code that will not break in the various readers. 1. Learn how to code HTML without the use of a visual editor Visual editors used by WYSWYG editors (abbreviation for What You See Is What You Get editors) usually throw in bad HTML code that can break an e-mail. Extraneous and redundant code is applied that often makes no sense and worse can cause problems in readers such as G-Mail. It is best to learn the simple HTML that needs to be used. This HTML is very close to what was used back in the late 90s during the dawn of the internet. Each different e-mail reader may use different ways of processing HTML code compared to others. Only the most simple code will work in almost all email readers. Tables and in-line styles are the way to format successful e-mails. For those who are unfamiliar with advanced HTML, you do not have to worry about this when composing e-mails. Only basic tables and CSS that is applied by inline styles are really needed. The use of tables is considered the ONLY way of creating e-mails in virtually all the tutorials found on the internet. Make it a point to learn the basics of HTML and CSS if you want to compose professional, cleanly formatted emails! How to Properly Compose E-Mail HTML Code : 2

2. Use tables everywhere and use divs sparingly Tables are your friends in e-mail code. They surround all of the content in such a way that will not break in most e-mail readers. With a table you can make sure that a column of text will appear where you expect it to appear. Images will stay where you want them to stay and not overlap text or other content unexpectedly. On the other hand, divs should be used sparingly. This is because some e-mail readers do not respect the boundaries that divs create around content. This can cause content to spread out in ways that can break an email. For example, if you need for text to appear in the body of an email contained within a 500px width, using a div set with a width of 500px to contain the text will have the unwanted result of some email readers ignoring that width and spreading the text out. Tables can be used to get extremely accurate positioning of elements in a design if you use td tags that contain width or height attributes coupled with spacer graphics. The spacer graphic should be a transparent gif that is created with a width and height of exactly 1px. So, for instance, if a header graphic needs to be exactly 30px away from the border, instead of trying to use padding or margin of 30px use multiple tds instead. Margin and padding may be interpreted differently by various email readers, so use them sparingly (and use tds instead). EXAMPLE: <table border= 0 cellpadding= 0 cellspacing= 0 width= 300 > <tr> <td width= 30 height= 150 ><img src= images/spacer.gif width= 30 height= 150 border= 0 alt= > <td width= 270 ><img src= images/header.jpg width= 270 height= 150 border= 0 alt= Bringing You Great Value! > </tr> </table> In the above example you may notice that the width and height of the spacer graphic is given a width greater that 1, in this case width= 30 and height= 150. The original spacer graphic of course remains at 1px. What is happening here? Think of the spacer graphic as a maleable placeholder in the code that can be given any width or height as needed. This is to ensure that a width or height is properly rendered in most email readers. Outlook 2007 in particular may ignore a width or height set in a How to Properly Compose E-Mail HTML Code : 3

td containing a spacer graphic if those dimensions are only called in the td itself (and the spacer graphic is just given height and width of 1) So place that value for desired width and height in both the td that contains the spacer graphic and inside the spacer graphic itself. <td width= 30 height= 150 ><img src= images/spacer.gif width= 30 height= 150 border= 0 alt= > Note that some tutorials found online specify not to use spacer graphics since some email readers don t show graphics by default. However, this will not be a problem if you always specify a width and height either of 1 or to the exact dimension for the spacing desired (whichever the email design requres for accurate reproduction). That way if the spacer image is just shown as an empty placeholder then at least the desired width and height may be applied (thus not breaking a design). 3. Avoid the use of CSS except to create the basics such as background color, font formatting and some content padding. Forget about using more advanced CSS such that is used, for example, in absolute positioning relative to a container. Most e-mail readers only accept the basics in CSS. On a side note, don t try to use background images to create background textures or graphics in a td or div tag. Many e-mail readers ignore background images entirely. If you do try to use them, always also specify a background color that testing shows it will display well should the background image be stripped out. There is one exception to this rule and that is for calling background images for the body tag. Even this exception does not display as needed in some e-mail readers. For only advanced e-mail coders - it is not covered here. 4. Don t use external stylesheets for CSS Don t use external stylesheets to create CSS. External stylesheets are usually referenced inside the head tags. For some e-mail readers all content embedded inside the head tags is stripped out. DON T DO THIS (continued on next page): How to Properly Compose E-Mail HTML Code : 4

<head> </head> <link href= css/en_offerstyles.css type= text/css rel= stylesheet > 5. Don t create CSS inside the head tags Again, content inside the head tags may be stripped out. DON T DO THIS: <head> <style type= text/css > p {font-weight: normal; color: gray; } h1 {color: black; } </style> </head> 6. Use inline styles for CSS Create CSS at the root element by using inline styles. EXAMPLE: < p style= font-family: Tahoma, Arial, sans-serif;color:#f6f6f6; >Some text</p> 7. If classes or ids for CSS are used, place them under the opened body tag If for some reason classes or ids are used, be sure to embed them directly under the opened body tag. This is unheard of for CSS used in regular HTML web pages but is the only way for many e-mail readers to apply classes. Enclose each CSS declaration inside <!-- --> so that Lotus Notes can read it. How to Properly Compose E-Mail HTML Code : 5

EXAMPLE: </head> <body> <style type= text/css > </style> /* The comment tags around each style are there to help Lotus notes not ignore them. */ <!--.border1 { border:1px solid #DEDEDE;} --> <!--.disclaimertext { font:normal 10px Tahoma, arial, sansserif;color:#979696;line-height:14px; } --> <!--.fontsize1 { font-size:12px; } --> <!--.fontsize2 { font-size:11px; } --> <!--.marginpadding1 { margin:0;padding:10px 0 6px 0; } --> <!--.padding1 { margin:11px 0 6px 0;padding:0 } --> 8. Always match all class= statements with style= at root element The only way to guarantee that most email readers will accept CSS is to apply style= for the desired CSS values at the root element (where the class or ID is to be used). Just referencing classes/ids declared under the closed head tag without also spelling out the class/id attributes with style= will cause some e-mail readers to ignore the attributes. EXAMPLE OF CORRECT USE OF CLASSES PAIRED WITH INLINE STYLES: < p class= font1 style= font-family: Tahoma, Arial, sans serif;color:#f6f6f6; >Some text</p> This is why in almost all cases it is better never to use classes or ids and simply apply CSS using inline styles. Unfortunately some visual editors such as the one used by Dreamweaver insist on placing class= to create content attributes. You must then go into the code and place style= paired with the desired attributes anywhere class= is used. How to Properly Compose E-Mail HTML Code : 6

9. Prevent Gmail and Hotmail from placing unwanted padding around images A quirk of Gmail and Hotmail is to place unwanted padding around images. This can be a problem if you are using spacer images inside <td> tags to control layout spacing. The fix involves two parts. First, inside the <td> containing the graphic place this: <td height= 10 style= line-height:1.0 > <img src= images/spacer.gif width= 1 height= 10 border= 0 alt= style= display:block > NOTE: Only do this when a <td> contains JUST images and NO TEXT. If text is also used here, then it will be squashed tiny because the text line height will be forced into a height of 1px! Next, in the code for each image place this: <td height= 10 style= line-height:1.0 > <img src= images/spacer.gif width= 1 height= 10 border= 0 alt= style= display:block > NOTE: If 2 or more images are to be displayed inline inside a single container, placing this code will force them onto separate rows. An example of where not to do this is shown below. 2 images, say for social media icons like facebook and twitter, are to be on one line and are also both contained inside just one <td> or <div>. The way to force them onto the same line is to use inline CSS of display:inline : <td height= 10 > <img src= images/facebook.gif width= 20 height= 10 border= 0 alt= Facebook style= display:inline ><img src= images/twitter.gif width= 15 height= 10 border= 0 alt= Twitter style= display:inline > If display:block is used they will probably be forced onto 2 separate rows and will not be side by side. How to Properly Compose E-Mail HTML Code : 7

To avoid this problem altogether it is better to contain each social media icon inside a separate <td>. Then you can use display:block and line-height:1.0 to avoid any excessive padding issues. <td height= 10 style= line-height:1.0 > <img src= images/facebook.gif width= 20 height= 10 border= 0 alt= Facebook style= display:block > <td height= 10 style= line-height:1.0 > <img src= images/twitter.gif width= 15 height= 10 border= 0 alt= Twitter style= display:block > 10. Prevent iphone text enlargement The iphone automatially changes font sizes when a web page is zoomed in or out. For many email designs this will cause the text to flow in unwanted areas and break the overall design. To prevent this, use the following code placed just after the opening body tag (same as would be used to create CSS classes: </head> <body> <style type= text/css > /* CSS to prevent iphones resizing text and breaking the email design */ <!-- * { -webkit-text-size-adjust: none; } --> </style> 11. Validate HTML code using the free W3C validator When you are done with the HTML code, use the free W3C validator to catch many possible errors (see next page): How to Properly Compose E-Mail HTML Code : 8

http://validator.w3.org/#validate_by_input Not all the errors shown will be a concern. The validator is very strict on code. Use it to catch tags that are not closed properly, redundant code, etc.. Applying these coding tips will make for much happier results when sending out e-mails. At least there will be less chance of making a bad impression from the email design awkwardly breaking! How to Properly Compose E-Mail HTML Code : 9