關於ie8兼容的問題 在bootstrap官方文檔已經給了相應的解決方案
頭部加入
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1">
后面還需要加入
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script> <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script> <![endif]-->
這段意思是在ie9以及ie9以下可以使用 別的ie寫法(做個標記)
<!--[if !IE]><!--> 除IE外都可識別 <!--<![endif]--> <!--[if IE]> 所有的IE可識別 <![endif]--> <!--[if IE 6]> 僅IE6可識別 <![endif]--> <!--[if lt IE 6]> IE6以及IE6以下版本可識別 <![endif]--> <!--[if gte IE 6]> IE6以及IE6以上版本可識別 <![endif]--> <!--[if IE 7]> 僅IE7可識別 <![endif]--> <!--[if lt IE 7]> IE7以及IE7以下版本可識別 <![endif]--> <!--[if gte IE 7]> IE7以及IE7以上版本可識別 <![endif]--> <!--[if IE 8]> 僅IE8可識別 <![endif]--> <!--[if IE 9]> 僅IE9可識別 <![endif]-->
當然有人會說:我加入了但是還是不兼容啊
那么你一定沒有仔細看官方文檔
有沒有看到file://協議 意思就是放在服務器來生效奧!
如果有人用了rem 想要兼容ie8 請用 rem.js