我知道这对于css条件格式化是可能的:
<!--[if !IE]>
link/css style goes here
<![endif]-->
Run Code Online (Sandbox Code Playgroud)
但是有可能在那里有OR语句吗?如:
<!--[if !IE or !Opera]>
link/css style goes here
<![endif]-->
Run Code Online (Sandbox Code Playgroud)
提前致谢!
条件注释是IE特有的功能,将被Opera等忽略.
它们确实支持"或",但是像这样的管道形式;
<!-- [if (IE 6)|(IE 7)]>
this is only seen by IE 6 and 7
<![endif]-->
Run Code Online (Sandbox Code Playgroud)
编辑
正如评论的那样,在可能的情况下编写跨浏览器兼容的CSS确实更可取,并且仅使用条件注释作为最后的手段.为了让生活更轻松,请务必避免怪异模式并使用功能检测而不是用户代理嗅探.查看有助于后者的modernizr库.