• 页面布局(3)——多列定宽自适应


    多列定宽自适应

    <!DOCTYPE html>
    <html lang="en">
    
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <meta http-equiv="X-UA-Compatible" content="ie=edge">
      <title>定宽+自适应</title>
      <style>
        .left1 {
    
          float: left;
           100px;
          margin-right: 20px;
        }
    
        .right2 {
          overflow: hidden;
        }
    
        .left2 {
    
          float: left;
           100px;
        }
    
        .right2 {
          margin-left: 120px;
        }
    
        .parent3 {
          display: table;
           100%;
          table-layout: fixed;
        }
    
        .left3 {
           100px;
          padding-right: 20px;
        }
    
        .right3,
        .left3 {
          display: table-cell;
        }
    
        .parent4 {
          display: flex;
        }
    
        .left4 {
           100px;
          margin-right: 20px;
        }
    
        .right4 {
          flex: 1;
        }
    
        .parent5 {
           100%;
          display: -webkit-box;
        }
    
        .left5 {
           100px;
          margin-right: 20px;
        }
    
        .right5 {
          -webkit-box-flex: 1;
        }
      </style>
    </head>
    
    <body>
      <!-- 使用float+overflow -->
      <div class="parent">
        <div class="left1">
          <p>
            left1
          </p>
        </div>
        <div class="right1">
          <p>
            right1
          </p>
          <p>
            right1
          </p>
        </div>
      </div>
    
      <!-- 使用float+margin -->
      <div class="parent">
    
        <div class="left2">
    
          <p>
            left2
          </p>
    
        </div>
    
        <div class="right2">
    
          <p>
            right2
          </p>
    
          <p>
            right2
          </p>
    
        </div>
      </div>
      <!-- 使用table -->
      <div class="parent3">
    
        <div class="left3">
    
          <p>
            left3
          </p>
    
        </div>
    
        <div class="right3">
    
          <p>
            right3
          </p>
    
          <p>
            right3
          </p>
    
        </div>
      </div>
      <!-- 使用flex -->
      <div class="parent4">
    
        <div class="left4">
    
          <p>
            left4
          </p>
    
        </div>
    
        <div class="right4">
    
          <p>
            right4
          </p>
    
          <p>
            right4
          </p>
    
        </div>
      </div>
      <!-- 使用display -->
      <div class="parent5">
    
        <div class="left5">
          left5
        </div>
    
        <div class="right5">
          right5
        </div>
    </body>
    
    </html>
    
  • 相关阅读:
    [SDOI2009]生日礼物(单调队列)
    [luogu1638]逛画展(单调队列)
    【最短路】·SPFA算法实现
    [UVA10474]大理石在哪儿
    【转载】C++中string erase函数的使用
    【转载】高精度减法的OP写法
    【转载】ST表
    串门赛: NOIP2016模拟赛——By Marvolo 丢脸记
    Bzoj 3813 奇数国 题解 数论+线段树+状压
    Bzoj 2064 分裂 题解
  • 原文地址:https://www.cnblogs.com/janas-luo/p/9605289.html
Copyright © 2020-2023  润新知