div布局三行两列自适应

三行两列布局,实现头部和底部高度固定,宽度100%;中间左侧部分宽度固定,高度自适应;中间右侧宽度、高度都自适应。主要使用了绝对定位来排版,

效果如下:

代码如下:

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type="text/css">
        .header
        {
            position: absolute;
            width: 100%;
            height: 100px;
            top: 0px;
            left: 0px;
            background-color:#3580D7;
        }
        .left
        {
            position: absolute;
            width: 180px;
            top: 100px;
            left: 0px;
            bottom: 60px;
            background-color:#CCCCCC;
        }
        .right
        {
            position: absolute;
            top: 100px;
            left: 180px;
            bottom: 60px;
            right: 0px;
             background-color:#F0F8FF;
        }
        .footer
        {
            position: absolute;
            width: 100%;
            height: 60px;
            left: 0px;
            bottom: 0px;
            background-color: #3580D7;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div class="header">
        头部固定高度,宽度100%
    </div>
    <div class="left">
        中间左侧固定宽度,高度自适应
    </div>
    <div class="right">
        中间右侧宽度自适应,高度自适应
    </div>
    <div class="footer">
        底部固定高度,宽度100%
    </div>
    </form>
</body>
</html>
posted @ 2013-03-28 19:07  jinjiabo  阅读(405)  评论(0编辑  收藏  举报