Reputation: 95
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
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