需求1: 头尾固定高度,中间自适应

1.上部(header)Div高度固定100px,宽度100%;

2.下部(footer)Div高度固定100px,宽度100%;

3.中部(middle)DIV高度根据屏幕高度,自适应充满(是根据内容自动填满),宽度100%;

4.用纯DIV+CSS实现,不采用脚本计算高度的方式;

5.调整浏览器大小时,中部DIV能随着屏幕高度自适应。

CSS部分

<style type="text/css">
*{
margin:;
padding:;
text-align: center;
}
.container{ background: #fff;
margin: 0 auto;
text-align: left;
}
.header{
padding: 10px 0;
background: pink;
}
.middle{
padding: 10px 0;
}
.footer{
padding: 0px;
background:pink;
} </style>

HTML部分

<div class="container">
<div class="header">
<p>heder</p>
</div>
<div class="middle">
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
</div>
<div class="footer">
<p>footer</p>
</div>
</div>

需求2:头部固定,中间和底部设置为绝对定位,

      *{
margin:;
padding:;
}
.container{
text-align: center;
font-size: 30px;
}
.header,.footer{
width: 100%;
height: 200px;
line-height: 100px;
background-color: red;
}
.middle{
width: 100%;
position: absolute;
top: 100px;
bottom:100px;
background-color: yellow;
}
.footer{
position: absolute;
bottom: 0px;
}

最新文章

  1. BZOJ 4614 【Wf2016】 Oil
  2. Android 学习第17课,使用文件的数据存储(4种存储模式)
  3. unity3d5.2.3中 调整视角
  4. Visual Studio 2013智能提示失效解决办法
  5. [Unity菜鸟] 协程Coroutine
  6. Github是什么?看完你就了解一些了
  7. JavaScript设计模式之----组合模式
  8. 为什么要使用CMake?
  9. js实现获取当前时间是本月第几周和年的第几周的方法
  10. cent6.x配置主机名及静态网络
  11. 第三章:Activity的生命周期
  12. Kotlin入门(17)等式判断的情况
  13. [UE4]嵌套Canvas
  14. 通过这些示例快速学习Java lambda语法
  15. 管理KVM虚拟机(二)
  16. 使用Ocelot构建GateWay
  17. Sqlite 常用函数推荐
  18. ASLR
  19. hdu4347
  20. webshell三剑客[aspxspy、phpspy、jspspy]

热门文章

  1. Linux MySql状态、启动、停止、重启命令
  2. 怎样创建一个OpenStack官方账号?
  3. jQuery前端插件以及图片延迟加载
  4. delphi两个取字串长度的函数strlen,length
  5. (十八)Centos之firewall 防火墙命令
  6. (九)会话跟踪技术之Cookie
  7. PostgreSQL学习笔记——事务
  8. 【Leetcode_easy】720. Longest Word in Dictionary
  9. JMETER安装教程
  10. QT OpenGLWidget的surfaceFormat