css style and inline style not working in outlook 2007 - html

I have a html newsletter page. I need to send it to the given mail id. In Outlook , I'm unable to see the my styled html page but in browser css and inline style works perfectly. So why in Outlook does not work inline or Css style?

To get good cross-compatibility it's wise to go with last centuries web practices.
Use tables for structure, style inline, use pixel measurements and be prepared for images to fail.
These basics provide robust results in most clients.

Its best to also avoid background images since these wont work either in outlook.

Related

Rendering HTML template in Email clients

I have HTML template completely written with div, a, img, button elements with inline CSS styling. It renders perfectly in HTML editors but not in Email clients. Should it be completely written in table form for Email clients? Here is my code:
Look it on JSFiddle
I believe your particular question is dependent on which email-client you are targeting. It would be helpful if you could specify which email-client you are looking to use, as well as which parts of your html are not working, because certain email-clients may not support certain parts of your code.
For example, as defined here,
Outlook has the following problems for rendering HTML:
Outlook does not “understand” HTML bulleted list tags
Outlook uses Times New Roman as the default font
Outlook may add a page break to an email if it exceeds 1800px
Outlook cleans up paragraph and margin spacing
Outlook does not support background images
Which you may be able to fix by using specific techniques, such as, as you mentioned, wrapping with tables. I found a link here that may be helpful if you are trying to resolve the rendering on Outlook.
If there is another specific email-client you need to target, there should be posts on stack overflow or on the web for resolving them as well.
Good luck!
You do have to use tables in email HTML and then use CSS and formatting to mask it. Here's a handy guide you can use for email HTML.

MSO-specific CSS hack for Outlook HTML email?

There's a ton of IE conditional hacks (such as ending a style property with !ie, various uses of the * character, etc.).
I tried several of these in an inline style in an email sent to Outlook (2013), but they did not appear to work.
I tried mso-width-alt:100% but what little documentation I can find doesn't show it supporting percentages.
I also tried !mso just to see if it did anything, but it did not.
I'm wondering if anyone knows of any CSS hacks that can be used for Outlook/MSO inline styles?
More specifically, I have a table that needs to be width:100% in Outlook, but breaks in iOS so I'm using min-width:100%, which doesn't work in Outlook. I know I can wrap the table tag in a conditional and swap it out completely to make it work, but I'm trying for a more elegant solution if one exists.
Prepend property with !
<table style="!width:100%"></table>
Appears to affect MSO and IE<=7 only:
I am going to have so much fun with this.

Can I use a DIV in an email template?

I am greatly confused about designing an email template for a mailchimp campaign. I want to know if I can use a div with a class of "Container" on my email template. Is using div tags supported by all mail clients? I am using DIV only for the container but in the inner part of the template I have used table, tr and td tags. Please let me know.
Thanks.
You can use div, however tables are supported more consistently. If you try to go the div route, you'll find some of your CSS will fail.
Also, by going with tables, it opens up the old school html attributes that only work in tables. These include align, valign, bgcolor etc, all of which are 100% supported, while their CSS equivalents have partial support.
On a side note, here are all the resources you will need to get started in html email.
As of April 2017, yes, you can use <div> tags in email. Outlook was the only major email client that didn't support them.
See https://github.com/rodriguezcommaj/principles-of-email-design and https://www.sendwithus.com/resources/templates
There is no specifications for layout using table-less nor tables. However, using tables is the preferred way as it renders all at once. This aligns with how email templates render; while div's render separately. If you use div's include your css inline to the template as some clients do not support external css.

Is it possible to apply Z-index using HTML?

I have a long vertical email form that I am editing from an old template made out of tables and the widths don't match up perfectly all the way down so what I intend to do is add a div or image etc behind all the tables so it is just wider than the widest table and it will hide the messy table layout and make the email form look unified and neat.
I've done a similar thing in the past but using z-index on CSS. As I am sending this to Outlook I don't want to use CSS.
Sorry if my post is confusing. Any help appreciated
The short answer is NO, it is not possible to do that with HTML only unless and until you are willing to change the order of your markup, else as far as the CSS goes, you can use z-index inline for that particular element.
So for example
<div style="z-index: /* Whatever */"></div>
While it is true that inline styling works across all major modern mail clients, z-index does not. I'm sorry to have to say this, but you're probably gonna have to rebuild your nested tables from the ground up if their sizes don't match.
As a quick example: Outlook 2007 uses word as a rendering engine. z-index will never display with that client, therefore will completely break your layout. And a lot of people still use outlook 2007, like it or not.
If you need some layering effects, you'll have to use plain old images and cut those so they fit in table cells. It's a pain, but that's part of the html-email world, and that's probably what you are being paid for.
You can use inline CSS. This works in outlook and all other email clients.

CSS for mail doesn't apply?

I have no idea what's going on now. I threw together a simple page with very simple CSS. I used tables cause i know you can't use div elements like normal for emails. So after viewing it in my browser, it looks like this:
http://i.stack.imgur.com/8FBtf.png
And after sending it through mail (the cells data has been replaced):
http://i.stack.imgur.com/tuXvA.png
So the CSS doesn't apply at all!
Here's the HTML and CSS:
http://pastebin.com/PySeeW4m
Any ideas?
Most e-mail clients only read the CSS if it is provided inline through style= tags, Mailchimp provides a great tool to do this automatically:
CSS Inliner Tool
CSS in e-mail is only partially supported and support differs greatly amongst clients. Have a look at http://www.campaignmonitor.com/css/
You probably need to have all CSS inline for more compatibility.
please consider that f.i. gmail strips out style definitions from the HTML template.
You can use a workaround and include style information direct in the element like this
<div style="width:150px">...</div>
To use your css like it is right now just use a css parser and attach it to the elements via a regular expression
Regards