<!DOCTYPE HTML>
<html lang="ru-RU">
<head>
<title></title>
<meta charset="UTF-8">
<style type="text/css">
html,body {
height:100%;
overflow:hidden;
}
*{margin:0;padding:0}
li,input,button{height:35px;}
#content{
height:100%;
margin-top:100px;
margin-left:100px;
width:60%;
}
#box{
height:100%;
bottom:35px;
text-align:center;
border:1px solid red;
overflow:scroll;
}
li{
border:1px solid red;
margin-top:10px;
}
#header {
width:100px;
height:100px;
position:fixed;
top:0;
background:#FeE4B5;
}
#footer{
clear:left; /* 防止float:left对footer的影响 */
width:180px;
height:80px;
position:fixed;
bottom:0;
right:0;
background:#FFE4B5;
}
</style>
<script type="text/javascript">
function $(id) {
return document.getElementById(id);
}
function send(){
$("box").innerHTML+="<h1>"+$("msg").value+"</h1>";
$("box").scrollTop+=1000;
}
window.onload=function(){
$("box").onscroll=function(){
console.log(this);
console.log(this.scrollTop);
}
}
</script>
</head>
<body>
<div id="header"> this is header</div>
<div id="footer">
<input id='msg' type="" vavlue='1111'>
<button onclick='send()' >SEND</button>
</div>
<div id="content">
<div id='box'>
dfsfaf
</div>
</div>
</body>
</html>
header,footer都是fixed高度,让中间的section 高度随着屏幕高度自动分配 写成height 100% 怎么样才能实现留出footer的高度 ,让section容器的高度为根据屏幕自动设置为 100% 减去 footer的高度
少年啊少年~一根筋~
拿去玩~说爱我~
增加内容:
1,三星手机屎一样的兼容,请使用
作为perfix,谢谢;
2,既然po主使用的section,认为至少IE8以上;
可以抛弃flex;使用:
如果使用这种方法,注意webkit内核无法height:100%;
3,真心没太见过不兼容flex的手机,PO主用的luma?BB?