zoukankan      html  css  js  c++  java
  • 5种三栏布局的实现方式

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>5种三栏布局的实现方式</title>
    </head>
    <style type="text/css">
    * {
        margin: 0;
        padding: 0;
    }
    html,body {
        width: 100%;
        height: 100%;
    }
    /* 1、使用absolute实现
    .left,
    .right {
        position: absolute;
        top: 0;
         200px;
        height: 100%;
    }
    .left {
        left: 0;
        background: yellow;
    }
    .right {
        right: 0;
        background: green;
    }
    .center {
        margin: 0 210px;
        height: 100%;
        background: blue;
    }
    */
    /* 2、使用左右负margin实现
    .center {
         100%;
        height: 100%;
        float: left;
    }
    .box {
        height: 100%;
        margin: 0 210px;
        background: blue;
    }
    .left,
    .right {
         200px;
        height: 100%;
        float: left;
    }
    .left {
        margin-left: -100%;
        background: yellow;
    }
    .right {
        margin-left: -200px;
        background: green;
    }
    */
    /* 3、使用左右浮动实现
    .left,
    .right {
         200px;
        height: 100%;
    }
    .left {
        float: left;
        background: yellow;
    }
    .right {
        float: right;
        background: green;
    }
    .center {
        height: 100%;
        margin: 0 210px;
        background: blue;
    } */
    /* 4、使用flex实现
    .box {
        display: flex;
         100%;
        height: 100%;
    }
    .center {
        background: blue;
        flex: 1;
    }
    .left,
    .right {
        flex: 0 0 200px;
        background: red;
    } 
    */
    /* 5、使用table实现
    .box {
        display: table;
        height: 100%;
         100%;
    }
    .left,
    .center,
    .right{
        display: table-cell;
        height: 100%;
    }
    .left,
    .right{
         200px;
        background: blue;
    }
    .center{
        background: red;
    } 
    */
    </style>
    <body>
    <div class="box">
        <div class="left"></div>
        <div class="center"></div>
        <div class="right"></div>
    </div>
    <!-- 2、使用左右负margin实现
    <div class="center">
        <div class="box"></div>
    </div>
    <div class="left"></div>
    <div class="right"></div>
     -->
    
    <script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
    <script type="text/javascript">
    
    </script>
    </body>
    </html>
  • 相关阅读:
    【重点】2020年宝山区义务教育阶段学校校区范围与招生计划(初中)
    转: 彻底理解 Spring 容器和应用上下文
    转《深入理解 Java 内存模型》读书笔记
    Mysql Update 流程摘抄
    统一支付接口设计
    支付系统 简版设计
    订单1:n支付单 设计讨论
    RocketMQ 使用情况梳理
    转 Java jar (SpringBoot Jar)转为win可执行的exe程序
    Git flow 工作流与规范
  • 原文地址:https://www.cnblogs.com/vscss/p/8052176.html
Copyright © 2011-2022 走看看