Bootstrap模板代码+页面自适应页面的案例代码

[html]  view plain  copy
 print ? 在CODE上查看代码片 派生到我的代码片
  1. <!DOCTYPE html>  
  2. <html lang="en">  
  3.   <head>  
  4.     <meta charset="utf-8">  
  5.     <meta http-equiv="X-UA-Compatible" content="IE=edge">  
  6.     <meta name="viewport" content="width=device-width, initial-scale=1">  
  7.     <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->  
  8.     <title>Bootstrap 101 Template</title>  
  9.   
  10.     <!-- Bootstrap -->  
  11.     <link href="css/bootstrap.min.css" rel="stylesheet">  
  12.   
  13.     <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->  
  14.     <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->  
  15.     <!--[if lt IE 9]>  
  16.       <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>  
  17.       <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>  
  18.     <![endif]-->  
  19.     <style type="text/css">  
  20.         @media only screen and (min-width: 100px) and (max-width: 400px) {  
  21.             #test{  
  22.                 height:100px;  
  23.                 width:100px;  
  24.                 background: red;  
  25.             }  
  26.         }  
  27.         @media only screen and (min-width: 400px) and (max-width: 600px) {  
  28.             #test{  
  29.                 height:300px;  
  30.                 width:300px;  
  31.                 background:green;  
  32.             }  
  33.         }  
  34.         @media only screen and (min-width: 600px) and (max-width: 800px) {  
  35.             #test{  
  36.                 height:600px;  
  37.                 width:600px;  
  38.                 background: yellow;  
  39.             }  
  40.         }  
  41.     </style>  
  42.   </head>  
  43.   <body>  
  44.     <h1>Hello, world!</h1>  
  45.       
  46.     <div id="test">测试内容</div>  
  47.       
  48.     <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->  
  49.     <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>  
  50.     <!-- Include all compiled plugins (below), or include individual files as needed -->  
  51.     <script src="js/bootstrap.min.js"></script>  
  52.   </body>  
  53. </html>  

页面显示截图:

符合条件一的时候显示的效果:

2:符合条件二的时候显示的效果:

3、符合条件三显示的效果:


from: http://blog.csdn.net/tototuzuoquan/article/details/51299154

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值