最近刚开始看BootStrap3
发现在IE8下有不兼容现象,上网查了一下,解决方法如下:
1 声明meta
<meta http-equiv="X-UA-Compatible" content="IE=edge">(IE=edge
表示强制使用IE最新内核)
2 添加Respond.min.js
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
3 网上没查到我的这种情况,如果有请参考
引用Bootstrap.min.css文件时,将文件保存到本地再引用。我最开始引用的是,但在IE8下显示效果不兼容,但引用本地的Bootstrap文件就没有问题。
附代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>Narrow Jumbotron Template for Bootstrap</title>
<!-- Bootstrap core CSS -->
<link rel="stylesheet" href="dist/css/bootstrap.min.css">
<!-- Custom styles for this template -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<!-- Just for debugging purposes. Don't actually copy this line! -->
<!--[if lt IE 9]><script src="http://bootstrap.evget.com/assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
</head>
<body>
<div class="container">
<div class="col-lg-2 text-right">
<input type="button" value="Success Button" class="btn btn-success"/>
</div>
<div class="col-lg-4 text-left">
<input type="text" class="form-control"/>
</div>
<div class="col-lg-4 text-right">
<input type="password" class="form-control"/>
</div>
<div class="col-lg-2 text-left">
<input type="button" value="Default Button" class="btn btn-default"/>
</div>
</div> <!-- /container -->
<script type="text/javascript" src="dist/js/jquery.min.js"></script>
<script src="dist/js/bootstrap.js"></script>
</body>
</html>