«

布局

MitSeek 发布于 阅读:27 HTML


<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
        <style>
            body{
                min-height: 700px;
            }
            .header,.footer{
                border:1px solid #ffff00;
                background: #333333;
                text-align: center;
            }
            .left,.right,.center{

                min-height: 150px;
                position: relative;/* 相对定位 */
                float: left;
            }
            .container{
                padding: 0 200px;
                overflow: hidden;/* 清除浮动 */
                color: white;
            }
            .left{
                margin-left:-100%;
                left: -200px;
                width: 200px;

                background: green;

            }
            .center{
                width: 100%;
                background: blue;

            }
            .right{
                margin-left:-200px;
                right: -200px;
                width: 200px;
                background: red;
            }

        </style>
    </head>
    <body>
        <div class="header">
            <h3>head</h3>
        </div>
        <div class="container">
            <div class="center">
                <h3>左边</h3>
            </div>
            <div class="left">
                <h3>中间</h3>
            </div>
            <div class="right">
                <h3>右边</h3>
            </div>
        </div>
        <div class="footer">
            <h3>footer</h3>
        </div>
    </body>
</html>

HTML