Box model hacks for html email?

He has: 9 posts

Joined: Jun 2006

I'm producing an html email and need to define an element's width, padding and borders in pixels. This means that it breaks in Entourage, so I used the box model hack: voice-family: "\"}\""; voice-family:inherit; While this works fine in my various browsers and in Entourage, it doesn't work in Thunderbird (I don't know how it's treated in Windows browsers).

Does anyone know any tricks I can use?

He has: 113 posts

Joined: Jul 2005

these css hacks have a limited life span, and are browser specific. They are usually patched up with each browser release so the only real way around it is to ensure your pages are w3c compliant.

He has: 9 posts

Joined: Jun 2006

Browsers aren't the problem, as this hack just becomes redundant as browsers become compliant. The problem is with email clients. (I referred to 'Windows broswers' in my earlier post: this was a mistake, and should have read 'Windows email clients'.)

Megan's picture

She has: 11,421 posts

Joined: Jun 1999

From what I've read, using CSS in general in HTML email is a problem. I've actually just finished formatting one to be sent out. Basically, most CSS needs to be inline because some email clients will strip out the header altogether. What I have chosen to do is keep the important CSS inline and use a block in the head for some secondary formatting. A List Apart has a good article on this.

Generally, though, if you're separating presentation from content the email will work for everyone - it just might not look like you want it to all the time.

He has: 9 posts

Joined: Jun 2006

Megan wrote: What I have chosen to do is keep the important CSS inline and use a block in the head for some secondary formatting.

This is exactly what I did (but thanks for replying anyway!), so I think I'll just have to accept that it's not going to work. The result I wanted was by no means critical though, and everything else seems to work fine (including positioning, which slightly surprised me).

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.