Coding HTML Email Best Practices amp Tips
Coding HTML Email:
Best Practices & Tips
by Steve Hong (@st3v3hong)
Senior Web Developer
CrossComm, Inc.
http://slideshare.net/stevehong/
no notes exist for this slide
Prepare to be disappointed
Prepare to be disappointed.
Coding HTML email SUCKS!
Throw out web design best practices.
Dust off bloated "old-school" HTML table layouts.
Slap on inline CSS; no separation of presentation & content.
Forget things like video, audio, Flash, scripts, and forms.
no notes exist for this slide
Wait Dont leave
Wait! Don't leave!
HTML email is pretty and it works.
Communicate better through design.
Maintain consistent branding across all messages.
Jump on the bandwagon. Everyone's using HTML email.
Face it. There are no alternatives.
no notes exist for this slide
Coding HTML email Tips
Coding HTML email: Tips.
Code HTML/CSS by hand rather than in a WYSIWYG editor to ensure the code is clean and only includes supported elements.
no notes exist for this slide
Slide 5
Coding HTML email: Tips.
Use low-tech and simple table layouts without nesting or merging cells because CSS layouts with positioning donât work.
no notes exist for this slide
Slide 6
Coding HTML email: Tips.
Code only long-hand inline CSS styles instead of external or head stylesheets. CSS short-hand like âfontâ may not work, so write out individual properties like âfont-size.â
no notes exist for this slide
Slide 7
Coding HTML email: Tips.
Try a tool like Premailer to make your styles inline:
premailer.dialect.ca
no notes exist for this slide
Slide 8
Coding HTML email: Tips.
Use CSS primarily for text styling.
Put general text styles on parent td cells but donât rely on style inheritance from parent table cells to children cells.
Use inline CSS on heading and paragraph tags to overwrite inherited styles.
no notes exist for this slide
Slide 9
Coding HTML email: Tips.
Avoid font tags because they donât yield consistent font sizes.
no notes exist for this slide
Slide 10
Coding HTML email: Tips.
Wrap everything in a master 100% width table for background colors and other body styles because head and body tags are stripped out by webmail.
no notes exist for this slide
Slide 11
Coding HTML email: Tips.
Avoid conflicting with webmail CSS ID and class names by not using any or using unique names, like âclientname-footerâ, rather than generic names, like âfooter.â
no notes exist for this slide
Slide 12
Coding HTML email: Tips.
Reference images with absolute instead of relative paths because theyâre hosted on a web server.
no notes exist for this slide
Slide 13
Coding HTML email: Tips.
Use alt text in a header image to ask people to âplease turn on imagesâ so that they know theyâre missing out when their webmail turns off images.
no notes exist for this slide
Slide 14
Coding HTML email: Tips.
Add CSS text styles to table cells even if they contain only images because alt text will be styled when images are turned off.
no notes exist for this slide
Slide 15
Coding HTML email: Tips.
Take a look at MailChimpâs or CampaignMonitor's sample email templates:
bit.ly/mailchimptemp
bit.ly/campmontemp
no notes exist for this slide
Slide 16
Coding HTML email: Tips.
Check out CSS Tricksâ HTML email screencast for a how-to video:
bit.ly/csstricksemail
no notes exist for this slide
Test HTML email code
Test HTML email code.
Test with images and CSS turned off using the Firefox Web Developer Toolbar plugin:
bit.ly/ffwebdevtoolbar
no notes exist for this slide
Slide 18
Test HTML email code.
Set up many webmail test addresses and install several desktop email programs for testing.
For a fee, try MailChimpâs Inbox Inspector for final tests of your template:
bit.ly/mailchimpinsp
no notes exist for this slide
Slide 19
Test HTML email code.
Avoid spam filters in testing by avoiding the word âtestâ and dummy text like âlorem ipsum.â
Make every aspect of the email production-ready before testing it.
no notes exist for this slide
Look out for bugs
Look out for bugs.
Gmail doesnât honor background-repeat styles, so plan for repeating.
Gmail doesnât like quotes in font names. Donât use âfont-family:âLucida Grandeâ,â but rather âfont-family:Lucida Grandeâ.
no notes exist for this slide
Slide 21
Look out for bugs.
Gmail doesnât like percentage values for CSS line-height. Outlook 2007 creates too much line-height when em sizes are used. Use pixel sizes.
Gmail and Hotmail donât display background images declared with CSS, so use the background attribute of the table and td tags.
no notes exist for this slide
Slide 22
Look out for bugs.
Hotmail doesnât like CSS margins. Try using padding instead.
Hotmail sometimes adds extra space in cells with images. Try a line height of 70% of the font size like this: 12px font, 8px line-height
no notes exist for this slide
Slide 23
Look out for bugs.
Yahoo uses non-standard align and valign default values on table cells, so set them explicitly.
Yahoo has styles that make cellspacing ineffective on tables. Use cellpadding instead.
no notes exist for this slide
See other resources
See other resources.
MailChimpâs Guide:
bit.ly/mailchimpguide
CampaignMonitorâs Guide to CSS support in email clients:
bit.ly/campmoncsschart
no notes exist for this slide
Contact me
Contact me.
Steve Hong, Senior Web Developer, CrossComm
contact@stevehong.com
linkedin.com/in/stevehong
www.crosscomm.net
@st3v3hong
no notes exist for this slide
Find this online
Find this online.
SlideShare:
http://slideshare.net/stevehong/
CrossComm Blog:
crosscomm.net/blogs/web-strategy/online-marketing/how-to-code-html-email/
bit.ly/crosscommemailcode
no notes exist for this slide