简体   繁体   English

即使在使用respond.js之后,Bootstrap 3也无法在IE 8中工作

[英]Bootstrap 3 not working in IE 8 even after using respond.js

I've noticed that bootstrap 3 is not working in IE, more specifically the container class isn't working but it works in chrome and firefox. 我注意到引导程序3在IE中不起作用,更具体地说容器类不起作用,但它适用于chrome和firefox。 I even added respond.js here is my code 我甚至添加了respond.js这里是我的代码

<html>
<head>

<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="css/style.css">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 8]>
 <script src="js/html5shiv.js"></script>
 <script src="js/respond.min.js"></script>
<![endif]-->

 <link href='http://fonts.googleapis.com/css?family=Oxygen:400,300' rel='stylesheet' type='text/css'>


</head>
<body>

<div id="header" >
    <h1 class="text-center">surrdes</h1>
    <h2 class="text-center info_h1">Simple. Clean. Effective.</h2>
</div>
<div id="first_info">
    <div class="container">
        <h1 class="info_h1">sdfsdfsdfsdfsdfs</h1>
        <p class="d_p">fdsfdsfewfdsfsd</p>
    </div>


</div>
<div id="second_info">
    <div class="container">
        <h1 class="info_h1">fdsfsdfsdfsdfsdfsdfsdf</h1></div>

 </div>


</body>
</html>

What am i doing wrong? 我究竟做错了什么? I've searched all over the internet still can't get it working. 我在互联网上搜索仍然无法让它工作。

<!--[if lt IE 8]> enables the script only for IE7 and older ( lt means lower-than). <!--[if lt IE 8]>仅为IE7及更早版本启用脚本( lt表示低于)。 You want <!--[if lt IE 9]> or <!--[if lte IE 8]> instead. 你想要<!--[if lt IE 9]><!--[if lte IE 8]>

I just ran into a similar problem. 我刚遇到类似的问题。 As it turns out, the minified Bootstrap 3 css does not play nicely with Respond.js 1.4. 事实证明,缩小的Bootstrap 3 css与Respond.js 1.4不能很好地配合。 Instead, you must use an earlier version of Respond.js (1.3 seems to work for me). 相反,你必须使用早期版本的Respond.js(1.3似乎对我有用)。

Naturally, you must also follow all of the steps set forth in the Bootstrap docs . 当然,您还必须遵循Bootstrap文档中规定的所有步骤。 In short: 简而言之:

  • Use respond js and shiv 使用响应js和shiv
  • Use the ie-edge meta 使用ie-edge元
  • Don't use CDN's, just host on the same domain 不要使用CDN,只在同一个域上托管
  • Don't use @import or file:// 不要使用@import或file://

Here's another description of the bug and short testing markup for it https://gist.github.com/outlast/8602357 这是对它的错误和简短测试标记的另一种描述https://gist.github.com/outlast/8602357

我也有这个问题,我注意到当导入像src="js/respond.min.js它无法找到js文件在文件上给出了404.我将其更改为src="./js/respond.min.js所以从./开始添加它就能找到文件和div中心。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM