页面布局方案-上下固定,中间自适应

上下固定,中间自适应

三行布局, 上下固定,中间自适应

效果:

 

代码:

 1 <!DOCTYPE html>
 2 <html>
 3 <head>
 4     <title>上下固定,中间自适应</title>
 5     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 6     <style type="text/css">
 7         html{
 8             padding:50px 0px; /*上下设置为50px*/
 9             -webkit-box-sizing: border-box;
10             -moz-box-sizing: border-box;
11             box-sizing: border-box;
12             overflow:hidden;
13         }
14         html,body{margin:0; height: 100%;}
15         .top{
16             width:100%;
17             height:50px; /*值为padding的高度*/
18             margin-top: -50px;  /*值为padding的高度*/
19             background-color: #ff6600;
20             overflow: auto;
21             position:relative;
22         }
23         .main{
24             width:100%;
25             height: 100%;
26             overflow: auto;
27             background-color: #FFE69F;
28         }
29         .bottom{
30             width:100%;
31             height:50px;  /*值为padding的高度*/
32             overflow: auto;
33             background-color:#ff6600;
34         }
35     </style>
36 </head>
37 <body>
38 
39 <div class="top">
40     <p> 此布局仅适用于在body内布局 top 高度50px </p>
41 </div>
42 
43 <div class="main">
44     <p> 此布局仅适用于在body内布局 中间高度自适应 </p>
45 </div>
46 
47 <div class="bottom">
48     <p> 此布局仅适用于在body内布局 bottom 高度50px </p>
49 </div>
50 
51 </body>
52 </html>

 

转载于:https://www.cnblogs.com/ryanchancrj/p/9268994.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值