其他浏览器是否实现了条件注释?
IE 允许您根据浏览器的注释条件检测正在运行的 IE 版本(我实际上不知道他们是否这么称呼,如果不是,有人可以纠正我)。
<! --[if lt IE 7]> css code here.. <! [endif] -->
有谁知道其他浏览器是否效仿他们的示例来确定他们正在使用的浏览器版本?
<! --[if FF]> css code here.. <! [endif] -->
<! --[if O]> css code here.. <! [endif] -->
IE allows you to do detect which version of IE is running based on their browsers comment conditions (I actually don't know if that is what they are called, someone can correct me if it is not).
<! --[if lt IE 7]> css code here.. <! [endif] -->
Does anyone know if other browsers have followed their example to determine what version of thier browser is being used?
<! --[if FF]> css code here.. <! [endif] -->
<! --[if O]> css code here.. <! [endif] -->
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
一般来说,您不需要使用现代浏览器(FF3.6、Chrome、IE9、Safari)执行此操作。此外,如果您针对仍在变化的浏览器进行黑客攻击,那么您将面临黑客仍然有效但它解决的问题已修复的风险,然后您的修复就会中断。
Hacks 或条件注释应该只针对旧浏览器(IE6 和 IE7 是主要目标)。
In general, you shouldn't need to do this with modern browsers (FF3.6, Chrome, IE9, Safari). Also, if you target a hack at a browser that is still changing, you run the risk of the hack still working but the problem it solved being fixed, and then your fix breaks.
Hacks or conditional comments should only be aimed at old browsers (IE6 and IE7 are the main targets).
不,只有 Internet Explroer 和 可用条件是相当令人震惊的。
请注意,您通常可以使用条件注释来隐藏 IE 浏览器中的内容:
丑陋,丑陋,但是......
No, conditional comments are only supported by Internet Explroer and the list of available conditions is quite astounding.
Note that you can use conditional comments to hide things from IE browsers in general:
Ugly, ugly, though...
据我所知。您是否正在尝试提供不同的 CSS 或 CSS 和 JS/其他的组合?
也许在这种情况下,在 CSS 声明之前使用
-moz-
、-webkit-
和-o-
等供应商前缀可能对您有用。Not that I'm aware of. Are you trying to serve up different CSS or a combo of CSS and JS/other?
Perhaps using the vendor prefixes like
-moz-
,-webkit-
and-o-
before CSS declarations might work for you in that case.不,
条件注释仅限 IE。
Nope,
conditional comments are IE only.