2014-04-30 92 views
0

如何写像CSS属性的sintax:CSS有条件的问题,所有IE VS其他浏览器

.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

第一个问题是**为什么**你想这样做? –

+0

因为我有我的CSS样式的规则,没有任何类型的兼容性与Internet Explorer?我需要改变它......这就是为什么我想要这样做 – jvillegas

+0

他们可以做什么规则? –

回答

1

使用conditional stylesheets

目标IE 6 ONLY

<!--[if IE 6]> 
    <link rel="stylesheet" type="text/css" href="ie6.css" /> 
<![endif]--> 

目标IE 7 ONLY

<!--[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

+0

不会IE10 +忽略条件注释吗? –

+0

所以,@Chankey Pathak,我测试它,但我的同事和我谈论它,我们想这将是更好的改变它在同一个css – jvillegas

+0

@Paulie_D:那么问题是什么?如果用户使用IE10,那么他不需要检查IE6,IE7等。 –

相关问题