我正在创建一个响应式网站,但似乎无法让它在IE中工作(我在IE8中测试).现在,我知道Internet Explorer 8及以下版本不支持
CSS3媒体查询.但是我包含了
css3-mediaqueries.js
Javascript文件(由Google托管),但它仍然不起作用.
我删除了所有代码,只留下了最小的代码(字面上只有26行HTML和34行CSS). HTML成功验证为HTML5,CSS验证为CSS级别3.以下是代码:
HTML
<!DOCTYPE HTML> <html> <head> <Meta charset="utf-8"> <Meta name="viewport" content="width=device-width,maximum-scale=1.0,minimum-scale=1.0,initial-scale=1.0" /> <title>Responsive Site</title> <link rel="stylesheet" type="text/css" href="css/custom.css" /> <link rel="stylesheet" type="text/css" media="only screen and (min-width:50px) and (max-width: 800px)" href="css/responsive.css" /> <!--[if lt IE 9]> <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <!-- css3-mediaqueries.js for IE less than 9 --> <!--[if lt IE 9]> <script src="http://css3-mediaqueries-js.googlecode.com/svn/trunk/css3-mediaqueries.js"></script> <![endif]--> </head> <body> <div class="wrapper"> <div id="article"> </div> <div id="side"> </div> </div> </body> </html>
custom.css:
@charset "UTF-8"; /*html5 display rule*/ article,aside,canvas,details,figcaption,figure,footer,header,hgroup,menu,nav,section,summary {display: block;} body {margin: 0px; padding:0px} .wrapper { width:78%; margin:0 auto} #article { float:left; width:61.224489795%; margin:20px 0 0 0; padding:0; height:500px; background-color:#000} #side { float:right; width:30.775510204%; margin:20px 0 0 0; padding:0; height:500px; background-color:#999}
responsive.css:
@charset "UTF-8"; #article { width:100%} #side { width:100%; clear:left}