美文网首页
圣杯布局

圣杯布局

作者: daoqing99 | 来源:发表于2017-12-11 14:56 被阅读0次
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>圣杯布局</title>
    <style>
    * {
        margin: 0;
        padding: 0;
    }

    .left,
    .middle,
    .right {
        float: left;
        height: 400px;
        position: relative;
    }

    .left {
        width: 200px;
        background-color: yellow;
        margin-left: -100%;
        left: -200px;
    }

    .middle {
        background-color: black;
        width: 100%;
        color: red;
    }

    .right {
        width: 220px;
        background-color: grey;
        right: -220px;
        margin-left: -220px;
        z-index: 1;
    }

    header {
        height: 100px;
        background-color: red;
    }

    main {
        overflow: hidden;
        background-color: #fff;
        padding: 0 220px 0 200px;
    }

    footer {
        height: 100px;
        background-color: red;
    }
    </style>
</head>

<body>
    <header>圣杯布局头部</header>
    <main>
        <div class="middle">中间自适应</div>
        <div class="left">左边固定</div>
        <div class="right">右边固定</div>
    </main>
    <footer>底部</footer>
</body>

</html>

相关文章

网友评论

      本文标题:圣杯布局

      本文链接:https://www.haomeiwen.com/subject/uhviixtx.html