手机
当前位置:查字典教程网 >网页设计 > Div+Css教程 >网页上中下三分布局即上下固定中间自适应
网页上中下三分布局即上下固定中间自适应
摘要:*{margin:0;padding:0;}html,body,#box{height:100%;font:small/1.5"宋体",se...

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<>

<meta http-equiv="pragram" content="no-cache">

<>

<meta http-equiv="cache-control" content="no-cache, must-revalidate">

<>

<>

<meta http-equiv="expires" content="0">

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title></title>

<style type="text/css">

* {

margin:0;

padding:0;

}

html,

body,

#box {

height:100%;

font:small/1.5 "宋体", serif;

}

body {

text-align:center;

}

#box {

text-align:left;

background:#666;

display:table;

width:80%;

margin:0 auto;

position:relative;

}

#box > div {

display:table-row;

}

#header,

#footer {

background:#fcc;

height:50px;

vertical-align:bottom;

}

#main {

background:#ccf;

}

#main #wrap {

display:table-cell;

background:#ffc;

vertical-align:middle;

}

#text {

text-align:center;

}

</style>

<>

</head>

<body>

<div id="box">

<div id="header">header</div>

<div id="main">

<div id="wrap">

<div id="text">

<p>测试文本</p>

</div>

</div>

</div>

<div id="footer">footer</div>

</div>

</body>

</html>

【网页上中下三分布局即上下固定中间自适应】相关文章:

DIV+CSS网页布局对于网站的好处

css布局中的居中问题

div+css网页布局时不能滥用div元素

子元素div高度不确定时父div高度如何自适应

CSS制作网页布局实例:隐藏input文字

DIV下图片自适应解决方法

修复网页在IE8下的显示兼容问题

CSS如何给一个绝对定位的元素设定自适应宽度

CSS布局实例:上中下三行,中间自适应

学习css网页布局口诀

精品推荐
分类导航