【发布时间】:2014-10-10 21:26:22
【问题描述】:
我正在开发一个使用 Bootstrap UI 的 Web 应用程序。 不过其他浏览器看起来不错,但在 IE 10 版本中,UI 看起来很糟糕。
我在 bootstrap 官方网站上找到了解决方案。 它建议如下:
把它放在你的 CSS 和 JS 上。
CSS:
@-ms-viewport { width: device-width; }
@-webkit-viewport { width: device-width; }
@-moz-viewport { width: device-width; }
@-ms-viewport { width: device-width; }
@-o-viewport { width: device-width; }
@viewport { width: device-width; }
JS
if (navigator.userAgent.match(/IEMobile\/10\.0/)) {
var msViewportStyle = document.createElement('style')
msViewportStyle.appendChild(
document.createTextNode(
'@-ms-viewport{width:auto!important}'
)
)
document.querySelector('head').appendChild(msViewportStyle)
}
这就是我所做的:我将该 CSS 复制到位于 css 文件夹下的 your_style.css => 这不起作用,我不知道在哪里插入这个 JavaScript。
【问题讨论】:
标签: css twitter-bootstrap jquery-ui cross-browser internet-explorer-10