码迷,mamicode.com
首页 > 其他好文 > 详细

flex上下固定中间滚动条

时间:2017-06-12 00:45:10      阅读:693      评论:0      收藏:0      [点我收藏+]

标签:view   rect   垂直居中   高度   val   ble   initial   text   oct   

<!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>

flex上下固定中间滚动条

标签:view   rect   垂直居中   高度   val   ble   initial   text   oct   

原文地址:http://www.cnblogs.com/lzx12/p/6986878.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!