美文网首页
三栏布局

三栏布局

作者: bestCindy | 来源:发表于2020-10-25 15:24 被阅读0次
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Layout</title>
    <style media="screen">
        html *{
          padding: 0;
          margin: 0;
        }
        .layout article div{
          min-height: 100px;
        }
      </style>
</head>
<body>
    <!-- 浮动布局 -->
    <section class="layout float">
        <style media="screen">
            .layout.float .left {
                width: 200px;
                background-color: aqua;
                float: left;
            }
            .layout.float .right {
                width: 200px;
                background-color: aqua;
                float: right;
            }
            .layout.float .center {
                background-color: yellow;
            }
        </style>
        <h1>浮动布局</h1>
        <article class="left-center-right">
            <div class="left"></div>
            <div class="right"></div>
            <div class="center">
                <h1>浮动定位解决方案</h1>
                1.这是三栏布局中浮动定位中间部分
            </div>
        </article>
    </section>
    <!-- 绝对定位 -->
    <section class="layout absolute">
        <style media="screen">
            .layout.absolute {
                height: 133px;
            }
            .layout.absolute .left-center-right>div {
                position: absolute;
            }
            .layout.absolute .left {
                width: 200px;
                background-color: aqua;
                left: 0;
            }
            .layout.absolute .center {
                background-color: yellow;
                left: 200px;
                right: 200px;
            }
            .layout.absolute .right {
                width: 200px;
                background-color: aqua;
                right: 0;
            }
        </style>
        <h1>绝对定位</h1>
        <article class="left-center-right">
            <div class="left"></div>
            <div class="center">
                <h1>绝对定位解决方案</h1>
                1.这是三栏布局中绝对定位中间部分
            </div>
            <div class="right"></div>
        </article>
    </section>
    <!-- flex布局 -->
    <section class="layout flex">
        <style>
            .layout.flex .left-center-right {
                display: flex;
            }
            .layout.flex .left {
                width: 200px;
                background-color: aqua;
            }
            .layout.flex .right {
                width: 200px;
                background-color: aqua;
            }
            .layout.flex .center {
                flex: 1;
                background-color: yellow;
            }
        </style>
        <h1>flex 布局</h1>
        <article class="left-center-right">
            <div class="left"></div>
            <div class="center">
                <h1>flex布局解决方案</h1>
                1.这是三栏布局中 flex 布局中间部分
            </div>
            <div class="right"></div>
        </article>
    </section>
    <!-- table cell 布局解决方案 -->
    <section class="layout tablecell">
        <style>
            .layout.tablecell .left-center-right {
                width: 100%;
                height: 100px;
                display: table;
            }
            .layout.tablecell .left-center-right>div {
                display: table-cell;
            }
            .layout.tablecell .left {
                width: 200px;
                background-color: aqua;
            }
            .layout.tablecell .right {
                width: 200px;
                background-color: aqua;
            }
            .layout.tablecell .center {
                background-color: yellow;
            }
        </style>
        <h1>table cell 布局</h1>
        <article class="left-center-right">
            <div class="left"></div>
            <div class="center">
                <h1>table cell 布局解决方案</h1>
                1.这是三栏布局中 table cell 布局中间部分
            </div>
            <div class="right"></div>
        </article>
    </section>
    <!-- grid 布局解决方案 -->
    <section class="layout grid">
        <style>
            .layout.grid .left-center-right{
                width: 100%;
                display: grid;
                grid-template-rows: 100px;
                grid-template-columns: 200px auto 200px;

            }
            .layout.grid .left {
                background-color: aqua;
            }
            .layout.grid .center {
                background-color: yellow;
            }
            .layout.grid .right {
                background-color: aqua;
            }
        </style>
        <h1>grid 布局解决方案</h1>
        <article class="left-center-right"> 
            <div class="left"></div>
            <div class="center">
                <h1>grid 布局解决方案</h1>
                1.这是三栏布局中 grid 布局中间部分
            </div>
            <div class="right"></div>
        </article>
    </section>
</body>
</html>

相关文章

  • css经典布局总结

    布局类型 浮动布局 流式布局 定位布局 flex布局 grid布局 布局详解 1.浮动布局。 浮动布局是利用flo...

  • 布局小结

    布局方式 静态布局 浮动布局 定位布局 自适应布局 流式布局(百分比布局) 响应式布局 弹性布局 悬挂布局 圣杯布...

  • 常用的五大布局

    常用的五大布局(线性布局,相对布局,帧布局,表格布局,绝对布局) 1,线性布局 LinearLayout ...

  • 实现三栏布局的六种方式

    六种布局方式总结:圣杯布局、双飞翼布局、Flex布局、绝对定位布局、表格布局、网格布局。 圣杯布局 圣杯布局是指布...

  • CSS3开发常用核心技能

    基础网页布局 布局分类 一列布局 两列布局 三列布局 多列布局 一列布局: 二列布局: 三列布局: ⚠️ midd...

  • 移动端页面布局

    七大布局:流线布局、等比缩放拓展布局、分栏布局、流动布局、重复布局、固定布局1.流线布局流线布局指在界面中的内容元...

  • 前端网站5种布局

    前端基本布局分大致5种,table布局,float 布局,absolute布局,flexbox布局,grid布局。...

  • 2019-08-25

    布局 说法一 浮动布局 绝对定位布局 Flex布局 Table-cell表格布局 网格布局 说法二 静态布局 流式...

  • flex布局的几种典型布局方式

    flex布局的典型布局方式有哪些? 网格布局 固定底栏布局 圣杯布局 输入框布局 悬挂布局 网格布局 最简单的网格...

  • css3设计模式,常用布局

    1.css3常用的布局有多栏布局、多列布局、弹性布局、流式布局、瀑布流布局和响应式布局。2.float浮动布局,a...

网友评论

      本文标题:三栏布局

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