Ibrahim Aweidah
Ibrahim Aweidah

Reputation: 95

Why Doesn't My HTML Message Display Correctly in Outlook?

tr:nth-child(odd) {
background-color: #f2f2f2;
}

My code is working on alla web browsers but not in outlook. I need to Add Alternate Row Color. How can i achieve this ?

Upvotes: 1

Views: 1583

Answers (1)

user4437749
user4437749

Reputation: 74

Outlook's parser is nowhere near HTML5 nor CSS3 compliant.

You can learn what it does support in this webpage.

My suggestion, and what I had to do for my company, is to use a pre-processor to tag what are known to be "odd" with a class like <tr class="odd">...</tr>

And have a stylesheet with the rule:

tr.odd {
background-color: #f2f2f2;
}

Inline styles are also par for Outlook emails, but it is a brute force solution that is very frowned upon in HTML5, so it is a bad habit to get into.

Upvotes: 1

Related Questions