flex上下固定中间滚动条

<!DOCTYPE html>

 

<html>

 

<head lang="en">

 

<meta charset="UTF-8">

 

<title>flex上下固定中间滚动布局</title>

 

<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">

 

<style type="text/css">

 

 

 

*{padding: 0;margin: 0;}

 

html,body{height: 100%}

 

.wrap{width: 100%;height: 100%;}

 

.header,.footer{height:40px;line-height:40px;}

 

.main{overflow:auto;-webkit-overflow-scrolling: touch;}

 

/* ============================================================

 

flex:定义布局为盒模型

 

flex-v:盒模型垂直布局

 

flex-1:子元素占据剩余的空间

 

flex-align-center:子元素垂直居中

 

flex-pack-center:子元素水平居中

 

flex-pack-justify:子元素两端对齐

 

兼容性:ios 4+、android 2.3+、winphone8+

 

============================================================ */

 

.flex{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}

 

.flex-v{-webkit-box-orient:vertical;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}

 

.flex-1{-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1;}

 

.flex-align-center{-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;}

 

.flex-pack-center{-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;}

 

.flex-pack-justify{-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;}

 

</style>

 

</head>

 

<body>

 

<div class="wrap flex flex-v">

 

<div class="header">我想要它固定顶部部</div>

 

<div class="main flex-1">

 

<p>高度自动适应</p>

 

<p>高度自动适应</p>

 

<p>高度自动适应</p>

 

<p>高度自动适应</p>

 

<p>高度自动适应</p>

 

<p>高度自动适应</p>

 

<p>高度自动适应</p>

 

<p>高度自动适应</p>

 

<p>高度自动适应</p>

 

<p><input value="54545455654"/></p>

 

<p>高度自动适应</p>

 

<p>高度自动适应</p>

 

<p>高度自动适应</p>

 

<p>高度自动适应</p>

 

<p>高度自动适应</p>

 

<p>高度自动适应</p>

 

<p>高度自动适应</p>

 

<p>高度自动适应</p>

 

<p>高度自动适应</p>

 

<p>高度自动适应</p>

 

<p>高度自动适应</p>

 

<p>高度自动适应</p>

 

<p>高度自动适应</p>

 

<p>高度自动适应</p>

 

<p>高度自动适应</p>

 

<p>高度自动适应</p>

 

<p>高度自动适应</p>

 

<p>高度自动适应</p>

 

<p>高度自动适应</p>

 

<p>高度自动适应</p>

 

</div>

 

<div class="footer">我想要它固定底部<input value="54545455654"/></div>

 

</div>

 

 

 

</body>

 

</html>

转载于:https://www.cnblogs.com/lzx12/p/6986878.html

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值