你的位置:首页 > Java教程

[Java教程]一个自适应的宽度的两列网页布局


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>绝对定位:一栏固定,一栏自适应</title>
<style type="text/css">
<!--
* {
margin:0;
padding:0;
}
body {
background:#fff;
font:12px normal Arial #444;
line-height:18px;
text-align:center;
}
#box {
width:100%;
height:500px;
margin:0 auto;
background:#f2f2f2;
}
.header {
width:100%;
height:30px;
background:#39c;
}
.right {
width:240px;
height:400px;
background:#fff;
position:absolute;
right:20px;
top:50px;
}
.left {
margin-right:280px;
margin-top:20px;
background:#fff;
margin-left:40PX;
height:400px;
}
.content {
width:96%;
height:300px;
margin:0 auto;
background:#444;
}
.footer {
width:100%;
height:100px;
background:#f2f2f2;
}
p {
padding:10px 10px;
font-size:16px;
font-weight:bold;
color:#39C;
line-height:22px;
}
//
-->
</style>
</head>
<body>
<div id="box">
<div ><span >头部自适Div</span></div>
<div >
<p>左则自适应缩放</p>
<div >
<p>内容区块,相对父元素按百分比适应</p>
</div>
</div>
<div >
<p>绝对固宽定位的右侧栏>
</div>
<div >
<p>底部自适应</p>
</div>
</div>
<div>http://www.999jiujiu.com/</div>
</body>
</html>