我想将ie特定的css添加到css文件中。
.center{
margin-top:-40px !important;
}我试着添加
.ie .center{
margin-top:-40px !important;
}但是这个解决方案并不是work.Is有任何方法可以做到。
发布于 2014-05-06 12:19:23
把这个添加到你的头部标签中
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="ie.css" class="ie" />
<![endif]-->并将您的css粘贴到ie.css中。
.ie .center{
margin-top:-40px !important;
}如果您想要针对特定版本的IE,例如
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="ie10.css" class="ie10" />
<![endif]-->你们各自在ie10.css中的css应该是
.ie10 .center{
margin-top:-40px !important;
}发布于 2014-05-06 10:29:14
您需要编写html IF条件,以检查客户端的浏览器是否为IE。
<!--[if IE]> <link rel="stylesheet" type="text/css" href="ie.css" /> <![endif]-->
让你知道它会查找所有版本的。无论如何,我不建议使用这种方法,最好对所有浏览器都使用一个css文件。
发布于 2014-05-06 10:56:42
用这个。你可以在你的普通样式中使用它。不需要为IE制作其他的css文件。
.center{
margin-top:-40px; /* IE9 and below */
margin-top:-40px\9; /* IE8 and below */
*margin-top:-40px; /* IE7 and below */
_margin-top:-40px; /* IE6 */
}https://stackoverflow.com/questions/23491981
复制相似问题