我想应用CSS样式
margin-left, height,width
仅适用于IE浏览器。我尝试了以下方式,但也申请了其他浏览器。
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active)
#chart
{
margin-top : -105px;
}
@media screen and (min-width:0 )
{
#chart
{
margin-top : -105px;
}
}
@media screen/9 and (-ms-high-contrast: none), (-ms-high-contrast:
active)
#chart
{
margin-top : -105px;
}
请帮忙。谢谢。
我已经测试了以下代码。尝试
html:
<h1>try me </h1>
CSS:
html[data-useragent*='MSIE 10.0'] h1 {
color: blue;
}
JS:
var b = document.documentElement;
b.setAttribute('data-useragent', navigator.userAgent);
b.setAttribute('data-platform', navigator.platform );
https://css-tricks.com/ie-10-spetific-styles/
IE9或更高:
@media screen and (min-width:0) and (min-resolution: +72dpi) {
Your Code
}