Jump to content

CSS in email html, layout not showing same as web browser does


jason310771

Recommended Posts

I have created my email layout in Dreamweaver using html with doctype, html, head and body tags and it shows ok in IE and Firefox and in Windows Live Mail I have placed all of the CSS inside the email code inside the head tags.

 

When this is emails to someone with Outlook, Outlook completely changed the html and the CSS section ?!

 

How do I prevent this from happening or better still how to code this so that Outlook does not have to change anything.

 

 

Link to comment
Share on other sites

To layout an email one needs to apply all bad practices there are.

Use tables and inline style.(only with emails) maybe want to have a look at the standard templates of mailchimp to get the idea. There are quite some articles on designing emails. just google it.

Link to comment
Share on other sites

I frequently create marketing emails, so I can give a few more tips:

  • Keep the design simple, trust me, it'll make your life easier later down the road
  • Use tables (ugh, I know) and inline CSS
  • Don't bother with things like p, h1, h2, etc tags in the table. It'll just complicate your life more and adds no value to the code
  • Don't bother with paddings / margins. You should use spacer images instead (again, ugh)
  • For hotmail & images you'll notice there are probably some spacing issues (extra padding above and below the image). You can easily fix it by doing the following on all images:

Before...
<td><img src="http://mysite.com/images/logo.jpg" width="100" height="50" alt=""></td>

After...
<td style="line-height:0;"><img src="http://mysite.com/images/logo.jpg" width="100" height="50" alt="" style="display:block;"></td>

  • Be sure to place height/width attributes on images
  • Do not place height/width attributes on td/tr/tables.. Use inline css height/width.
  • http://premailer.dialect.ca/ is an AMAZING tool. Use it!
  • I can't believe I'm actually referring someone here, but: http://litmus.com is a good tool to use to preview across different email clients. It's a bit pricey if you're a solo developer ($50/month), and to be honest the service isn't terribly reliable - it provides the proper screenshots, but the access to the different email clients is very unstable IMO.

 

If you have any specific questions, or need more tips for certain clients let me know!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.