這種響應式的布局正是通過CSS3的媒體查詢(Media Query)功能實現的,根據不同的分辨率來匹配不同的樣式。IE8瀏覽器並不支持這一優秀的Css3特性,Bootstrap在開發文檔中寫了如何使用進行兼容IE8,如果想兼容IE6,IE7,可以搜索bsie (bootstrap2)。
http://v2.bootcss.com
1,注意,使用bootstrap最好使用2.0以下的jquery;
2,ie8以下不支持placeholder
<script type="text/javascript" src="js/bootstrap/jquery.placeholder.js"></script> <script type="text/javascript"> $(function () { $('input, textarea').placeholder(); }); </script>
總結:
<!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1" /> <meta name="author" content="zhy" /> <title>ie8</title> <link rel="stylesheet" href="css/bootstrap/bootstrap.min.css"> <!--[if lte IE 9]> <script src=js/bootstrap/respond.min.js"></script> <script src=js/bootstrap/html5shiv.min.js"></script> <![endif]--> <script src="js/bootstrap/jquery-1.12.0.min.js"></script> <script src="js/bootstrap/bootstrap.min.js"></script> </head> <body> </body> </html>
IE判斷IE版本的語句:
<!--[if lte IE 6]> <![endif]--> IE6及其以下版本可見 <!--[if lte IE 7]> <![endif]--> IE7及其以下版本可見 <!--[if IE 6]> <![endif]--> 只有IE6版本可見 <![if !IE]> <![endif]> 除了IE以外的版本 <!--[if lt IE 8]> <![endif]--> IE8以下的版本可見 <!--[if gte IE 7]> <![endif]--> IE7及大於IE7的版本可見
lte:就是Less than or equal to的簡寫,也就是小於或等於的意思。
lt : 就是Less than的簡寫,也就是小於的意思。
gte: 就是Greater than or equal to的簡寫,也就是大於或等於的意思。
gt : 就是Greater than的簡寫,也就是大於的意思。
! : 就是不等於的意思,跟javascript里的不等於判斷符相同