A1G*_*ard 17 css internet-explorer internet-explorer-8 twitter-bootstrap twitter-bootstrap-3
我在我的网页中使用bootstrap 3.0.3并添加html5shiv lib并响应lib以解决此问题,但它无法在Internet Explorer 8上运行.
我的HTML代码:
<div class="container">
<div class="row">
<div class="col-sm-4" style="background:red;"> </div>
<div class="col-sm-4" style="background:green;"> </div>
<div class="col-sm-4" style="background:blue;"> </div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
它在FF和Webkits浏览器中运行良好但导致IE:
现在演示在这里,我该如何解决?
Noo*_*tor 19
基于线程中的解决方案:Must Bootstrap容器元素包含行元素?,你的标记应该是:
<div class="container">
<div class="row">
<div class="col-sm-4" style="background:red;"> </div>
<div class="col-sm-4" style="background:green;"> </div>
<div class="col-sm-4" style="background:blue;"> </div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
并使用此CSS在IE8中实现它:
.container
{
display:table;
width: 100%;
}
.row
{
height: 100%;
display: table-row;
}
.col-sm-4
{
display: table-cell;
}
Run Code Online (Sandbox Code Playgroud)
这是工作演示
.row
在a里面不需要这个类.container
,但是如果你包含那个,那么container> row就是命令而不是row> container(你编码)!
编辑
值得注意的是,respond.js
仅适用于本地文件.因此,如果您css
在IE8上为您的网站提供了CDN引导文件,那么它将无法使用,而是尝试使用本地副本bootstrap.css
Internet Explorer 8和Respond.js
在Internet Explorer 8的开发和生产环境中使用Respond.js时,请注意以下警告.
Respond.js和跨域CSS 使用Respond.js与托管在不同(子)域上的CSS(例如,在CDN上)需要一些额外的设置.有关详细信息,请参阅Respond.js文档.
Respond.js和file:// 由于浏览器安全规则,Respond.js不适用于通过file://协议查看的页面(就像打开本地HTML文件时一样).要在IE8中测试响应功能,请通过HTTP(S)查看您的页面.有关详细信息,请参阅Respond.js文档.
Respond.js和@import Respond.js不适用于通过@import引用的CSS.特别是,已知一些Drupal配置使用@import.有关详细信息,请参阅Respond.js文档.
IE兼容模式 旧的Internet Explorer兼容模式不支持Bootstrap.为确保您使用IE的最新渲染模式,请考虑在页面中包含相应的标记:
资料来源:Getbootstrap