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

时间:2013-11-10 11:50:32

标签: html css twitter-bootstrap

我注意到bootstrap 3在IE中不起作用,更具体地说容器类不能正常工作,但它适用于chrome和firefox。我甚至添加了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>

我做错了什么?我在互联网上搜索过但仍然无法正常工作。

3 个答案:

答案 0 :(得分:1)

<!--[if lt IE 8]>仅为IE7和更早版本启用脚本(lt表示低于)。您需要<!--[if lt IE 9]><!--[if lte IE 8]>

答案 1 :(得分:1)

我遇到了类似的问题。事实证明,缩小的Bootstrap 3 css与Respond.js 1.4不能很好地配合。相反,你必须使用早期版本的Respond.js(1.3似乎对我有用)。

当然,您还必须遵循Bootstrap docs中规定的所有步骤。简而言之:

  • 使用回复js和shiv
  • 使用ie-edge meta
  • 不要使用CDN,只需托管在同一个域
  • 请勿使用@import或file://

以下是对https://gist.github.com/outlast/8602357

的错误和简短测试标记的另一种描述

答案 2 :(得分:0)

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