頁面經常使用佈局,三欄佈局,聖盃佈局,雙飛翼佈局

三欄佈局–flexbox佈局

</head>
<body>
    <!--flexbox  -->
    <section class="layout flexbox">
        <style>
            .layout.flexbox .left-center-right{
                display: flex;
            }
            .layout.flexbox .left {
                width: 300px;
                background: red;
            }
            .layout.flexbox .center {
                background: yellow;
                flex: 1;
            }
            .layout.flexbox .right {
                width: 300px;
                background: blue;
            }
        </style>
        <h1>三欄佈局</h1>
        <article class="left-center-right">
            <div class="left"></div>
            <div class="center">
                <h2>flexbox解決方案</h2>
                1.這是三欄佈局的浮動解決方案; 2.這是三欄佈局的浮動解決方案; 3.這是三欄佈局的浮動解決方案; 4.這是三欄佈局的浮動解決方案; 5.這是三欄佈局的浮動解決方案; 6.這是三欄佈局的浮動解決方案;
            </div>
            <div class="right"></div>
        </article>
    </section>
</body>
</html>

三欄佈局–grid佈局

<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>Layout</title>
    <style media="screen">
        html * {
            padding: 0;
            margin: 0;
        }

        .layout article div {
            min-height: 150px;
        }
    </style>
</head>

<body>
    <!--網格佈局-->
    <section class="layout grid">
        <style>
            .layout.grid .left-center-right {
                display: grid;
                width: 100%;
                grid-template-columns: 300px auto 300px;
                grid-template-rows: 150px;
            }
            .layout.grid .left {
                background: red;
            }
            .layout.grid .center {
                background: yellow;
            }
            .layout.grid .right {
                background: blue;
            }
        </style>
        <h1>三欄佈局</h1>
        <article class="left-center-right">
            <div class="left"></div>
            <div class="center">
                <h2>網格佈局解決方案</h2>
                1.這是三欄佈局的浮動解決方案; 2.這是三欄佈局的浮動解決方案; 3.這是三欄佈局的浮動解決方案; 4.這是三欄佈局的浮動解決方案; 5.這是三欄佈局的浮動解決方案; 6.這是三欄佈局的浮動解決方案;
            </div>
            <div class="right"></div>
        </article>
    </section>
</body>

</html>

三欄佈局–表格佈局

<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>Layout</title>
    <style media="screen">
        html * {
            padding: 0;
            margin: 0;
        }

        .layout article div {
            min-height: 150px;
        }
    </style>
</head>

<body>
    <!--表格佈局-->
    <section class="layout table">
        <style>
            .layout.table .left-center-right {
                display: table;
                height: 150px;
                width: 100%;
            }

            .layout.table .left-center-right>div {
                display: table-cell;
            }

            .layout.table .left {
                width: 300px;
                background: red;
            }

            .layout.table .center {
                background: yellow;
            }

            .layout.table .right {
                width: 300px;
                background: blue;
            }
        </style>
        <h1>三欄佈局</h1>
        <article class="left-center-right">
            <div class="left"></div>
            <div class="center">
                <h2>表格佈局解決方案</h2>
                1.這是三欄佈局的浮動解決方案; 2.這是三欄佈局的浮動解決方案; 3.這是三欄佈局的浮動解決方案; 4.這是三欄佈局的浮動解決方案; 5.這是三欄佈局的浮動解決方案; 6.這是三欄佈局的浮動解決方案;
            </div>
            <div class="right"></div>
        </article>
    </section>
</body>

</html>

三欄佈局–浮動佈局

<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>Layout</title>
    <style media="screen">
        html * {
            padding: 0;
            margin: 0;
        }
        .layout article div {
            min-height: 150px;
        }
    </style>
</head>
<body>
    <!--浮動佈局  -->
    <section class="layout float">
        <style media="screen">
            .layout.float .left {
                float: left;
                width: 300px;
                background: red;
            }

            .layout.float .center {
                background: yellow;
            }

            .layout.float .right {
                float: right;
                width: 300px;
                background: blue;
            }
        </style>
        <h1>三欄佈局</h1>
        <article class="left-right-center">
            <div class="left"></div>
            <div class="right"></div>
            <div class="center">
                <h2>浮動解決方案</h2>
                1.這是三欄佈局的浮動解決方案; 2.這是三欄佈局的浮動解決方案; 3.這是三欄佈局的浮動解決方案; 4.這是三欄佈局的浮動解決方案; 5.這是三欄佈局的浮動解決方案; 6.這是三欄佈局的浮動解決方案;
            </div>
        </article>
    </section>
</body>
</html>

三欄佈局–絕對佈局

<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>Layout</title>
    <style media="screen">
        html * {
            padding: 0;
            margin: 0;
        }
        .layout article div {
            min-height: 150px;
        }
    </style>
</head>
<body>
    <!--絕對佈局  -->
    <section class="layout absolute">
        <style>
            .layout.absolute .left-center-right>div{
                position: absolute;
            }
            .layout.absolute .left {
                left:0;
                width: 300px;
                background: red;
            }

            .layout.absolute .center {
                left: 300px;
                right: 300px;
                background: yellow;
            }

            .layout.absolute .right {
                right: 0;
                width: 300px;
                background: blue;
            }
        </style>
        <h1>三欄佈局</h1>
        <article class="left-center-right">
            <div class="left"></div>
            <div class="center">
                <h2>絕對定位解決方案</h2>
                1.這是三欄佈局的浮動解決方案; 2.這是三欄佈局的浮動解決方案; 3.這是三欄佈局的浮動解決方案; 4.這是三欄佈局的浮動解決方案; 5.這是三欄佈局的浮動解決方案; 6.這是三欄佈局的浮動解決方案;
            </div>
            <div class="right"> 1.這是三欄佈局的浮動解決方案; 2.這是三欄佈局的浮動解決方案; 3.這是三欄佈局的浮動解決方案 1.這是三欄佈局的浮動解決方案; 2.這是三欄佈局的浮動解決方案; 3.這是三欄佈局的浮動解決方案</div>
        </article>
    </section>
</body>
</html>

聖盃佈局

<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <title>Layout</title>
  <style media="screen">
  html * {
    padding: 0;
    margin: 0;
  }

  </style>
</head>

<body>
  <style>
  .container {
    padding-left: 220px;
    padding-right: 220px;
  }

  .left {
    float: left;
    width: 200px;
    height: 400px;
    background: red;
    margin-left: -100%;
    position: relative;
    left: -220px;
  }

  .center {
    float: left;
    width: 100%;
    height: 500px;
    background: yellow;
  }

  .right {
    float: left;
    width: 200px;
    height: 400px;
    background: blue;
    margin-left: -200px;
    position: relative;
    right: -220px;
  }

  </style>
  <article class="container">
    <div class="center">
      <h2>聖盃佈局</h2>
    </div>
    <div class="left"></div>
    <div class="right"></div>
  </article>
</body>

</html>

雙飛翼佈局

<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>Layout</title>
    <style media="screen">
    html * {
        padding: 0;
        margin: 0;
    }
    </style>
</head>

<body>
    <style>
    .container {
        min-width: 600px;
    }

    .left {
        float: left;
        width: 200px;
        height: 400px;
        background: red;
        margin-left: -100%;
    }

    .center {
        float: left;
        width: 100%;
        height: 500px;
        background: yellow;
    }

    .center .inner {
        margin: 0 200px;
    }

    .right {
        float: left;
        width: 200px;
        height: 400px;
        background: blue;
        margin-left: -200px;
    }
    </style>
    <article class="container">
        <div class="center">
            <div class="inner">雙飛翼佈局</div>
        </div>
        <div class="left"></div>
        <div class="right"></div>
    </article>
</body>

</html>
相關文章
相關標籤/搜索
本站公眾號
   歡迎關注本站公眾號,獲取更多信息