user1501974
user1501974

Reputation: 85

html comment with conditional expression

In foundation css they use this at top of html doc as last in a series of conditional browser checks.

<!--[if gt IE 8]><!--> <html lang="en"> <!--<![endif]-->

When IE version is greater than IE 8, what is the equivalent expression?

<!--> <html lang="en"> <!-- ?????

I take it <!--> is legal syntax for an empty comment?

The <!--<![endif]--> block is confusing me.

Is the endif evaluated even though it appears to be nested inside a comment?

Isn't the <![endif] always commented out regardless of IE version? Or does IE still evaluate this even though it appears to be inside html comment?

I guess I need some help figuring out how this is parsed and how start/end tags are matched.

Upvotes: 2

Views: 114

Answers (1)

hjuster
hjuster

Reputation: 4070

This part of code will be f.e executed only in internet explorer no matter it looks like a comment:

<!--[if IE]><!-->
function onlyIE(){
    some code...
}
<!--<![endif]-->

You can find more info on this link

Upvotes: 1

Related Questions