Edit–Please answer the specific question, this post isn’t about if Conditional Comments are valid, not valid, a thing of the past, which IE versions support it… etc. Thanks.
In the following Conditional Comment, what is does this part <!--> do or mean, or if it’s necessary?
And now that I’m reading it again, it does mention what the <!--> does:
This example uses valid HTML, but IE7 and later browsers will also reveal the --> after the opening conditional statement. The fix suggested by Microsoft is to add an extra < ! just after the opening conditional comment:
<!--[if gte IE 7]><!-->
<p>This is shown in downlevel browsers and IE7 or later.</p>
<!--<![endif]-->
The article calls it Downlevel-revealed Conditional Comments which I did not know the name of.
It’s the last example in that section.
It’s basically putting a Conditional Comment inside an HTML comment so IE7+ browsers don’t reveal the --> after the opening conditional comment… o_O
That’s what hides the IE9- conditional comments from browsers that don’t understand them such as Chrome, Firefox, IE10 etc.
If you didn’t need to hide them from other browsers you could write <![if gte IE 7]> <![endif]>
– inside of conditional comments are ignored by versions of IE that understand the comments so <!--[ gets treated the same as <![ and ]--> gets treated the same as ]>
That was originally taken (almost word by word) from the book (and reference) that Tommy and I wrote quite a few years earlier. Glad to see its still useful