zoukankan      html  css  js  c++  java
  • flex 上下div固定, 中间div自适应

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
    html,body{height:100%;margin: 0;padding: 0;}
    .flex-container{height: 100%;display: flex;flex-direction: column;text-align: center;
    100%;
    position: absolute;
    top: 0;
    left:0;
    }
    .flex-item:nth-child(1),.flex-item:nth-child(3){flex-grow: 0;flex-shrink: 0;background-color: #ababab;}
    .flex-item:nth-child(2){flex-grow: 1;flex-shrink: 1;background-color: #000;overflow-y: auto; color: #fff;}
    .center{position: fixed;top: 50%;left: 50%;margin-top: -10px;margin-left: -24px;}
    </style>
    </head>
    <body>
    <div class="flex-container">
    <div class="flex-item">top</div>
    <div class="flex-item">
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    center<br>
    </div>
    <div class="flex-item">bottom</div>
    </div>
    </body>
    </html>

  • 相关阅读:
    Vue cmd命令操作
    迭代器和生成器
    10-外键的变种 三种关系
    09-完整性约束
    08-数据类型(2)
    07-数据类型
    06-表的操作
    05-库的操作
    04-基本的mysql语句
    03-MySql安装和基本管理
  • 原文地址:https://www.cnblogs.com/freespider/p/9121270.html
Copyright © 2011-2022 走看看