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>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM