CSS布局--上中下布局(上下固定,中间自适应)
2015-07-23 13:43
726 查看
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
<title></title>
<style type="text/css">
* {
margin:0;
padding:0;
font-family: Calibri, Arial, Sans-Serif;
}
html,body,.box {
height:100%;
}
.box {
text-align:left;
background:#666;
display:table;
width:90%;
margin:0 auto;
position:relative;
}
.box>div {
display:table-row;
}
.header,.footer {
background:#fcc;
height:50px;
text-align: center;
line-height: 50px;;
}
.main {
background: #aec8ff;
text-align: center;
}
</style>
</head>
<body>
<div class="box">
<div class="header">
HEADER
</div>
<div class="main">
CONTENT
</div>
<div class="footer">
FOOTER
</div>
</div>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
<title></title>
<style type="text/css">
* {
margin:0;
padding:0;
font-family: Calibri, Arial, Sans-Serif;
}
html,body,.box {
height:100%;
}
.box {
text-align:left;
background:#666;
display:table;
width:90%;
margin:0 auto;
position:relative;
}
.box>div {
display:table-row;
}
.header,.footer {
background:#fcc;
height:50px;
text-align: center;
line-height: 50px;;
}
.main {
background: #aec8ff;
text-align: center;
}
</style>
</head>
<body>
<div class="box">
<div class="header">
HEADER
</div>
<div class="main">
CONTENT
</div>
<div class="footer">
FOOTER
</div>
</div>
</body>
</html>
相关文章推荐
- css去掉iPhone、iPad默认按钮样式
- css3开发酷炫滑动导航
- 给 UILabel 中的文字增加 line-through / Strikethrough (删除线)样式
- css中的expression
- CSS清除浮动
- 7.23css样式
- 利用CSS的类名切换,进行DIV的显示隐藏,简化JS
- CSS布局:三列布局自适应问题
- 学习CSS(6)
- CSS 多浏览器兼容性问题及解决方案
- CSS+DIV简单布局
- css position
- 2015.7.22 第十一课 课程重点(jq:元素获取、添加、删除、过滤、判断、遍历、取值,样式设置、改变对象、切换、判断)
- 使用CSS样式表格式化XML文档
- CSS清除浮动大全共8种方法
- 来问项目-less文件的组织
- css3中变形与动画(一)
- 使用css实现圆角图形绘制
- CSS相对定位、绝对定位之我见
- CSS:选择器