tags:

views:

301

answers:

4

possible duplicate: What tools to automatically inline CSS style to create email HTML code ?

note from author: Oh yeh, definitely duplicate. Sorry.

In general, HTML emails do not support proper CSS techniques.

However, it's nice to develop in these techniques because it makes it a lot quicker to play around with changes etc. (I don't need to sell the benefits of CSS to you all!)

Is there a tool that will take lovely HTML and turn it into nasty email compatible HTML with all the styles extrapolated from the CSS files and placed inline?


Even though 100% compatibility cannot be achieved due to the numerous differences in email clients out there, a tool that helps the process would be very useful, even if it simply takes the CSS and inlines it.

A: 

There are no standards for "email compatible" CSS or HTML, so a tool to perform this task is unlikely to exist. Various client strip out different tags and attribues, especially web-based ones. A lot of it is trial and error. Trial and error is difficult to automate.

Diodeus
I agree, but this is quite unhelpful because there are certain things that can help you, even if you still have to trial and error. No one asked for coding to be automated but we love our IDEs. Why? Because although coding still takes hard work, IDEs automate *some* of the process. Or like ORMs, you still have a lot of work to do, but they help speed up the process. Even a tool that just takes the CSS and inlines it would be very useful.
joshcomley
@Diodeus: I think the point is to have HTML with inlined style. It's not a matter of "standard" or not. Just whether one can produce inline style from a page that references an external style sheet.
Cheeso
Yes, but there's no promising the stylesheet, as inline styles, would even come close to working, and it certainly won't do any good at all for a CSS-based layout vs. a tabled-based one. You're better off rebuilding the HTML from scratch.
Diodeus
@Diodeus - I completely disagree. I am asking for a tool that *helps me build HTML specifically for email from scratch* but speeds up a lot of the repetitive work associated with that. I'm not after something that converts HTML for a website to HTML for an email. If I've set a class for <a> tag to display as links as green and I have fifteen <a> tags, such a tool is very, very handy. I'm not really talking positioning, simple things like fonts, colours, sizes etc. Again, I cite my IDE example - don't automate everything, just help where possible
joshcomley
A: 

I imagine you could run the text of the page through a script that will discover CSS classes and ids and store the styles for them in an array, then go through and replace class="class" with style="style" and id="id" with style="style" etc. It would just be a matter of programming the thing.

joeylange
+1  A: 

Campaign Monitor have an excellent guide to CSS support in email clients as of 2008. It's very comprehensive.

John Topley
useful, but not yet the complete solution.
Cheeso
A: 

Unfortunately, I don't know of any tools, but I would think this could be done using javascript (using jQuery, prototype, or other js framework), to rip through the rendered DOM and discover applied styles and create new HTML based on that

A good start would be to have a source div tag and a target div tag and see that the HTML in the target ends up looking like the source.

slolife