51

I found a snippet of code that allows me to target clients that have outlook 2007 or higher.

<!--[if gte mso 9]><![endif]-->

Is there anyway to target everything but outlook or outlook 2007 & higher? If you're giving an answer please give working code as I've tried

<!--[if ! mso 9]> <!--[if ! mso]> <!--[if !(mso)]>

None of the following worked in Gmail with firefox.

2
  • 1
    Conditional comments are a Microsoft non-standard (though standards-compliant) implementation, allowing people to directly address flaws in the Microsoft family of html browsers/clients. As such, there's not usually an easy way to target other vendors' products with !IE or !mso syntax. Commented May 12, 2011 at 18:09
  • thanks, perhaps you could suggest the logic on how to hide a specific table row from outlook? Commented May 12, 2011 at 18:15

7 Answers 7

83

Try this:

<!--[if !mso]>--> content targeted at non-outlook users goes here... <!--<![endif]--> 
Sign up to request clarification or add additional context in comments.

2 Comments

To prevent statements being stripped in outlook.com, change <!--> to <!-- --> - check my answer for example
This doesn't work on outlook.com in a browser. Both the outlook content and non outlook content show up at the same time.
25

To prevent statements being stripped in outlook.com, change <!--> to <!-- --> -

<!--[if !mso]><!-- --> All Except MSO 07-13 <!--<![endif]--> 

2 Comments

This trick was stripping the content in the gmail app and the android mail app, strangely enough ...
This 'solution' was described in more detail here campaignmonitor.com/forums/topic/7544/…
7

Super late response, but hopefully this will help someone. This worked for me:

<!--[if !gte mso 9]><!----> <p>I'm not Outlook 2007/2010.</p> <!--<![endif]--> 

Edit: Answered above, but extra tags on the IF statement are to hide the tags from being revealed in IE7/8.

Comments

4

That's is a solution:

<!--[if !mso]><!--> content without use in IE or Outlook <!--<![endif]--> 

I think so you can first resolve in IE, Outlook and denied with this for putting the elementss for all differents clients for email without Outlook.

regards

Comments

0

Microsoft defines a way to write conditional HTML that will be revealed in those clients that don't understand Microsoft's proprietary "conditional comments":

<![if !mso]> HTML meant for non-Outlook clients <![endif]>

They call it a "downlevel-revealed conditional comment", though it's not actually a comment at all, since comments start with <!--. Microsoft Office and Internet Explorer process the conditional statement (!mso evaluates false in Outlook), while other clients ignore the unrecognized tags. See Microsoft's documentation on conditional comments.

Comments

-1

Conditionals in comments like <!--[if gte mso 9]... is IE specific. Will not work in other browsers.

1 Comment

This is more like a comment…
-1

That's not how you have to use it. Instead it is, for everything except Outlook - normal routine, for Outlook - do specific. Not the other way around like you're trying to do.

1 Comment

That's true but this type of comment has its uses. Sometimes we do need to force Outlook to turn a blind eye on certain code, not other way around. For example, I discovered that compatibility tag caused trouble on Outlook: <meta http-equiv="X-UA-Compatible" content="IE=edge" />, I had to comment it out with "not-Outlook" comment. But in general, for template code, you're right.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.