zoukankan      html  css  js  c++  java
  • flex弹性盒布局示例

    刚学习弹性盒布局,实现下面的页面规划(故意弄复杂点看看如何实现)

    <!DOCTYPE html>
    <html lang="en">
      <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
    
        <style>
    
          .myscreen {
            display: flex;
            min-height: 100vh;
            flex-direction: column;
            text-align: center;
          }
    
          topinfo {
            height: 50px;
            background:red;
          }
    
          header,
          footer {
            height: 60px;
            background:#aaa;
          }
    
          .main {
            display: flex;
            flex: 1;
          }
    
          .content {
            flex: 1;
            background: #ccc;
          }
    
          
          .a,.b{
            display: flex;
            height: 50%;
          }
    
          .a {
            background: chartreuse;
            display: flex;
            flex-direction: row;
          }
          .a1{
            background: darkmagenta;
          }
          .a2{
            background:darkorange;
          }
          .a1,.a2{
            height: 100%;
            width: 50%;
          }
    
          .b {
            background: cyan;
          }
    
    
          .nav,
          .ads {
            /* 两个边栏的宽度设为12em */
            flex: 0 0 12em;
          }
    
          .ads {
            background: yellow;
          }
    
          .nav {
            /* 导航放到最左边 */
            order: -1;
            background: red;
          }
        </style>
      </head>
      <body class="myscreen">
        <topinfo>topinfo</topinfo>
        <header>header</header>
        <div class="main">
          <nav class="nav">nav</nav>
          <main class="content">
            <div class="a">
              <div class="a1">a1</div>
              <div class="a2">a2</div>
            </div>
            <div class="b">b</div>
          </main>
          <aside class="ads">aside</aside>
        </div>
        <footer>footer</footer>
      </body>
    </html>
  • 相关阅读:
    苦逼也聊模式--(0)--开篇
    发现无力吐槽
    JS函数调用
    初步使用nodejs(一)
    测试一下
    达摩流浪者
    Revit:二开使用Sqlite保存本地数据,并配合EF6等ORM框架
    Revity:查找并修改类型参数和实例参数
    复习一下UML
    Revit:ElementFilter过滤器基类
  • 原文地址:https://www.cnblogs.com/GarfieldTom/p/15348449.html
Copyright © 2011-2022 走看看