简体   繁体   English

带有条件表达式的html注释

[英]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. 在基础CSS中,他们在一系列条件性浏览器检查中的最后一个,在html doc顶部使用了它。

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

When IE version is greater than IE 8, what is the equivalent expression? 当IE版本大于IE 8时,等效表达式是什么?

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

I take it <!--> is legal syntax for an empty comment? 我认为<!-->是否为空注释的合法语法?

The <!--<![endif]--> block is confusing me. <!--<![endif]-->块使我感到困惑。

Is the endif evaluated even though it appears to be nested inside a comment? 即使endif似乎嵌套在注释中,也对其求值吗?

Isn't the <![endif] always commented out regardless of IE version? 不管IE版本如何, <![endif]总是被注释掉吗? Or does IE still evaluate this even though it appears to be inside html comment? 还是即使它似乎在html注释中,IE仍会对此进行评估?

I guess I need some help figuring out how this is parsed and how start/end tags are matched. 我想我需要一些帮助来弄清楚如何进行解析以及如何匹配开始/结束标签。

This part of code will be fe executed only in internet explorer no matter it looks like a comment: 这部分代码只能在Internet Explorer中执行,无论它看起来像什么注释:

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

You can find more info on this link 您可以在此链接上找到更多信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM