關於讓bootstrap3兼容ie8

官網上有說Internet Explorer 8 和 9 是被支持的,然而,你要知道,不少 CSS3 屬性和 HTML5 元素 -- 例如,圓角矩形和投影 -- 是確定不被支持的。另外,  Internet Explorer 8 須要 Respond.js 配合才能實現對媒體查詢(media query)的支持。
 
不過因爲學的不夠,在兼容ie8上浪費了太多時間摸索,接下來就給你們介紹一下個人摸索過程,僅供一樣是菜鳥的童鞋參考。
 
一樣是官網上說的,因爲瀏覽器的安全機制,Respond. js不能直接在本地訪問的頁面上發揮正常的功能,若是須要測試ie8響應式特性, 必須經過http協議訪問頁面(例如搭建apache、nginx等)。
 
 
經過http協議訪問頁面是重點,我是這麼作的:
一、將須要的文件引入(官網有頁面基本框架  http://v3.bootcss.com/getting-started/#template
<!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- 上述3個meta標籤*必須*放在最前面,任何其餘內容都*必須*跟隨其後! --> <title>Bootstrap 101 Template</title> <!-- Bootstrap --> <link href="css/bootstrap.min.css" rel="stylesheet"> <!-- 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="//cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="//cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script> <![endif]--> </head> <body> <h1>你好,世界!</h1> <!-- jQuery (necessary for Bootstrap's JavaScript plugins) --> <script src="//cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script> <!-- Include all compiled plugins (below), or include individual files as needed --> <script src="js/bootstrap.min.js"></script> </body> </html>
二、搭建本地服務器,下載wampserver,而後安裝,安裝好打開後能夠在桌面底部看到綠色w圖標 ,點開圖標到Apache,打開文件httpd.conf,而後修改數字127.0.0.1改成all。
三、將你的index.html頁面放到圖標那裏的 www目錄(w)
四、而後http://localhost /root/index.html就能訪問了
 
而後ie8一看,果真正常了。
相關文章
相關標籤/搜索