How to target Firefox and IE with CSS?
There's a slight difference on the layout of my website from webkit browsers to Firefox and Internet Explorer. I need to target Firefox and IE to apply some CSS only in those two browser.
I've tried for Firefox:
@-moz-document url-prefix() {
// CSS here
}
And I've tried for IE these two solutions:
<!--[if IE]><!-->
// Load specific CSS file here
<!--<![endif]-->
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
// CSS here
}
But nothing works. Do I need to do it with Javascript? If so, why can't I target it with CSS or HTML like everyone seems to do?
似乎为我工作:
// Firefox debug
@-moz-document url-prefix() {
#id {rules: argument;}
...
}
// IE debug
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
.class {rules: arg;}
...
}
Make sure your browser specific CSS is at the bottom of your CSS files. For ie it should be at the bottom of your head tag in your HTML and for moz make sure it's at the bottom of your CSS file.
链接地址: http://www.djcxy.com/p/29472.html上一篇: Android初学者填充和边距的区别
下一篇: 如何使用CSS定位Firefox和IE?