如何在css属性上写sintax,如:
.example{
/*all the browsers except IE*/
font-size:100%;
/*that's on all the IE syntax I need to add like a condition*/
font-size:200%
}
这是一个我知道的简单代码,只是为了测试它,而不是在html上,在css的类,id或标签中的每个属性上。
在ie6中:
#test{ _color: blue}
在ie6和ie7:
#test{ *color: blue}
ie6,ie7和ie8:
#test{ *color: blue\9}
但是如何区分所有IE和其他浏览器?
任何人都可以提供帮助吗?
答案 0 :(得分:1)
使用conditional stylesheets
仅限目标IE 6
<!--[if IE 6]>
<link rel="stylesheet" type="text/css" href="ie6.css" />
<![endif]-->
仅限目标IE 7
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="ie7.css">
<![endif]-->
目标IE的所有版本低于IE10
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="all-ie-only.css" />
<![endif]-->
除IE之外的一切目标
<!--[if !IE]><!-->
<link rel="stylesheet" type="text/css" href="not-ie.css" />
<!--<![endif]-->
由于IE10忽略条件评论,您可以尝试this solution。
详细了解here。