7

I understand that in order to display outlook-specific HTML within an email I can implement code such as:

<!--[if (gte mso 9)|(IE)]>
Welcome to the newsletter.
<![endif]-->

However, how do I implement if/else logic. For example, without using CSS classes, I need to display one section of content in Outlook and a completely different section of content in other clients.

Is this possible?

(CSS Classes have proven to be unreliable hence my requirements for conditional HTML instead).

1 Answer 1

14

The conditional coding IS actually the IF/ELSE statement. The issue is the ELSE part is not built in. To solve your issue, you need something to hide the content you no longer want MSO to use but show up in all other clients.

This can be handled either through conditional classes (in the if statement) OR, as you mentioned you did not want to use classes, you can use the mso-hide:all css that is only recognized by Microsoft office.

Found a great example of this for reference. Pulled from this post:

<!--[if mso]>
    <v:shape>...</v:shape>
    <div style="width:0px; height:0px; overflow:hidden; display:none; visibility:hidden; mso-hide:all;">
<![endif]-->

    [fallback goes here]

<!--[if mso]></div><![endif]-->

This is a good reference on usage of mso-hide:all

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.