Responsive design 响应框架的简单替代方案

Responsive design 响应框架的简单替代方案,responsive-design,Responsive Design,近几个月来,我已经完成了许多响应性构建,我认为我使用的基本样式表可能值得分享!这很简单,但很有效。我使用了几个Javascript库来修复常见的bug,但在注释中引用了这些bug HTML文档 我会考虑添加某种形式的HTMLRESETES;我确实有一个重置,但为了简单起见删除了它,因为大多数人都有自己的重置,他们经常使用。 <!DOCTYPE html> <html lang="en"> <head> <title></title>

近几个月来,我已经完成了许多响应性构建,我认为我使用的基本样式表可能值得分享!这很简单,但很有效。我使用了几个Javascript库来修复常见的bug,但在注释中引用了这些bug

HTML文档


我会考虑添加某种形式的HTMLRESETES;我确实有一个重置,但为了简单起见删除了它,因为大多数人都有自己的重置,他们经常使用。
<!DOCTYPE html>
<html lang="en">
<head>
   <title></title>
   <meta charset="utf-8">
   <meta name="description" content="" />
   <meta name="keywords" content="" />
   <meta name="copyright" content="" />

   <!-- http://modernizr.com -->
   <script src="scripts/modernizr.min.js"></script> 

   <link rel="stylesheet" href="css/base.css"  />    
</head>
<body>
   <header id="header" class="env clearfix"><p>Header Content</p></header>
   <div id="body-content" class="env clearfix">
       <p>Body Content</p>
       <p class="mobile-only">Hello Mobile Users</p>
   </div>
   <footer id="footer" class="env clearfix"><p>Footer Content</p></footer>
</body>
</html>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>

<!-- http://www.blog.highub.com/mobile-2/a-fix-for-iphone-viewport-scale-bug/ -->
<script src="scripts/MobileBoilerplate.js"></script>
<script type="text/javascript"> 
    MBP.scaleFix();
</script>

<!-- https://github.com/scottjehl/Respond -->
<script src="scripts/respond.min.js"></script> 
body{ }  

#header{ background-color:red; }
#footer{background-color:green;}

p{padding:25px;}

.env { position:relative; max-width:1000px; padding:0; margin:0 auto; width:100%; }
.mobile-only{display:none;}  

@media only screen and (min-width: 1000px)  
{
    .env { max-width: 1400px; }    
    p{padding:50px;}
}

@media only screen and (min-width: 701px) and (max-width: 850px) 
{
    body{font-size:0.9em;}
    .env { max-width: 850px; }    
    p{padding:20px;}
}

@media only screen and (min-width: 701px)  
{    
     .mobile-only{display:none !important;}  
}


@media only screen and (max-width: 700px) {
    .env { max-width: 700px;  min-width:300px;}
    body{font-size:0.9em;}

    .hide-in-mobile{display:none;}
    .mobile-only{display:block;}  
    p{padding:10px;}
}


@media only screen and (min-width: 450px) and (max-width: 700px) 
{
    p{padding:15px;}
}

@media screen and (-webkit-min-device-pixel-ratio: 2), screen and (max--moz-device-pixel-ratio: 2) {
    #logo{ background:url(/images/logo@2x.png) no-repeat; background-size: 84px 140px;   }
}


.clearfix:before, .clearfix:after { content: ""; display: table; }
.clearfix:after { clear: both; }
.clearfix { zoom:1;clear: both; }