Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

This might seem like a rant, but I am curious.

CSS replaced tables for layout a long time ago. But we still have to use tables for layout when creating rich emails.

Why is this? Are there any other options?

Are there really technical constraints that prevent CSS from working in an email. What are they? I can see how linked or embedded style sheets might be a problem, but not even inline styles work.

Is this ever going to change?

share|improve this question
17  
I don't need an entire webpage sitting in my inbox. Plaintext emails 4 life \m/ –  Anon. Feb 10 '11 at 20:30
3  
CSS hasn't replaced tables at all, even for layout. Browser support for CSS tables still sucks, even in 2011. –  user8685 Feb 10 '11 at 21:04
3  
@Developer art, browser support for css tables, maybe, but not css. I am not talking about using css for what tables or designed for. I am talking about not having to use tables for something they were never designed for, LAYOUT. –  JD Isaacks Feb 10 '11 at 21:16
3  
It's 2011 - Why do you still think HTML in emails is a good idea? –  Kim Feb 10 '11 at 21:28
5  
@kim, its not what I think, I don't make these decisions, its what the people above me think, and as long as the competition is doing it, we will have to as well. Unless something better replaces it. –  JD Isaacks Feb 10 '11 at 21:38
show 3 more comments

5 Answers

up vote 7 down vote accepted

CSS replaced tables for layout a long time ago. But we still have to use tables for layout when creating rich emails.

Why is this?

Lotus Notes and Outlook, mainly.

Not sure how Outlook 2010 is, but I believe Outlook 2007 still lacks support for CSS in many ways.

Is there really technical constraints that prevent CSS from working in an email. What are they?

Yes. The constraint is the rendering engine in a couple email clients that are still popular enough to have to be concerned with.

Is this ever going to change?

Probably. But, also probably, it will be a while.

Outlook should be catching up, but we may still be a couple years from a new version .. and if that still has lackluster support we'll be looking at another 2-3 years of this.

And then there's Lotus. Who knows if they'll ever support CSS or if they'll ever die off enough to ignore.

share|improve this answer
8  
Lotus Notes will not die. Its the most horrible piece of software on the planet, and it should be taken out the back and put out of its misery. But in really big companies, it scales really well and allows customisation really well. And once in a big company it gets its claws into everything and is almost impossible to remove. And that is why it will live on for a long, long time. –  quickly_now Feb 10 '11 at 22:23
3  
I feel the Lotus Notes hate. Every time I start a new role and I find they use Notes I die a little. –  Ian Feb 10 '11 at 23:15
add comment
  1. Outlook 2007 switched from Internet Explorer’s HTML rendering engine to Word’s HTML rendering engine. I wish I was kidding.

  2. Lots of people use webmail clients. If webmail clients fully rendered CSS, bad things could happen (Internet Explorer, for example, lets JavaScript run in CSS files).

  3. Lotus Notes is inexplicably popular in businesses, and Lotus Notes, including its HTML rendering, is terrible.

share|improve this answer
    
+1 for bagging Lotus Notes. –  quickly_now Feb 10 '11 at 22:27
    
@quickly_now: it’s never too early or too late to give Lotus Notes a swift kick in the nuts. –  Paul D. Waite Feb 10 '11 at 22:42
    
+1, this is why the problem isn't going to go away any time soon. Bad renderers need to be replaced by good renderers, and when newer versions of Outlook have worse renderers than old versions, we're going backwards not forwards. –  Carson63000 Feb 11 '11 at 0:34
    
@Carson63000: That was actually one of the worst things M$ have ever done, and that is saying something. Broke HTML emails far further than ever before in a single release. Why? Well for all the reasons quoted, it is because Outlook creates emails with Word in most places, so to achieve a consistent rendering, why not use Word to display them to? Joy. Please ensure all email viewers are broken to exactly the same degree as those that send the emails. –  Orbling Feb 11 '11 at 1:05
add comment

The other answers explain general problems with email, but you need to use <table> elements for layout in HTML e-mails because certain e-mail clients do not support the CSS property float (or any of the positioning properties, really) at all:

  • Outlook 2007 and 2010
  • Lotus Notes 6 and 7

Of course, without support for float or other positioning properties, there's no way to position elements except with the use of <table> elements. The necessity of using <table> elements for layout will not change as long as Microsoft continues to use the Word engine for Outlook and the Word engine continues to provide a lack of support for positioning elements.

Since Microsoft has pledged its full support for using the Word engine even after heavy criticism, one can only hope that the Word engine will support positioning elements in some future version. But since Outlook 2007 and 2010 are out there and heavily used, you'll always need to deal with them for at least a few more years.

Campaign Monitor has a handy chart which describes the CSS support in each of the major e-mail clients.

share|improve this answer
    
Useful chart, for comparison, see the MSDN feature support list. Apparently there is even software to download to validate against the Outlook mess. –  Orbling Feb 11 '11 at 1:08
add comment

Email is the number one usage of Internet, that's why it's such a problematic and slow process to move imho because there are just so many different clients and legacy systems to support (unlike web browsers where the number of big brands is much smaller).

But I would say the "solution" is progressive enhancement: best looking in modern email clients, yet doesn't prevent users from seeing the important contents in older ones. At your scale, that's all you can do to make things move in the right direction.

share|improve this answer
add comment

CSS Hasn't Replaced Tables!

For layouts? Yes. But tables still should be used for tabular data. I'm sorry but I'm tired of seeing people treating tables like the damn plague.

That said, a large reason is that tables have been around for a while so support is pretty well embeded into most, if not all email clients. Many have not been made to support modern CSS/JS/etc. and thus have to use a lot of old school HTML to get them to look decent.

share|improve this answer
3  
How about reading my whole answer? I explained what is going on. –  Glenn Nelson Feb 10 '11 at 21:03
2  
Yes, I did read your whole answer, and realize that you explained what is going on. However I think putting "CSS Hasn't Replaced Tables!" in a heading in this situation is akin to yelling this at the op. –  Craige Feb 10 '11 at 21:05
2  
@Craige Yeah, I'm just damn tired of CSS junkies treating tables like gotos. Are they abused? Yes. Are they useful? Yes. –  Glenn Nelson Feb 10 '11 at 21:06
2  
@Glenn Nelson - Agreed, though I have to agree that tables shouldn't be used for layout purposes. They are, and always have been meant to hold tabular data (ie. if you wouldn't put it in a spreadsheet, don't put it in a table). –  Craige Feb 10 '11 at 21:09
4  
I never once said CSS has replaced tables. If I was emailing tabular data, I would not have asked this question. Tables were never intended for layout, CSS is. So CSS for layout is not "set in stone" but it is currently the only thing that was created with the purpose of layout. I really don't appreciate your condescending answer, I do not know how you inferred that I think tables are always bad in every situation, when I was specifically talking about layout. What I am tired of is people who are quick to jump on peoples case without cause. –  JD Isaacks Feb 10 '11 at 21:27
show 7 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.