• 移动端经典的flex布局


    指明父元素为display:flex;然后给子元素一个flex值就可以按各元素所占的flex比值均分

    <!DOCTYPE html>
    <html>
      <head>
        <meta charset="utf-8">
        <style media="screen">
          .tab{
            display: flex;
             100%;
            background: red;
            height: 40px;
            line-height: 40px;
    
          }
          .tab .tab-item{
            flex: 2;
            text-align: center;
          }
          .tab .tab-item:hover{
            background: blue;
          }
        </style>
        <title>d</title>
      </head>
      <body>
    
        <div class="tab">
          <div class="tab-item">
            apple
          </div>
          <div class="tab-item">
            pear
          </div>
          <div class="tab-item">
            orange
          </div>
        </div>
    
    
      </body>
    </html>
    
    

    1:2:3

    <!DOCTYPE html>
    <html>
      <head>
        <meta charset="utf-8">
        <style media="screen">
          .tab{
            display: flex;
             100%;
            background: red;
            height: 40px;
            line-height: 40px;
    
          }
          .tab .tab-item1{
            flex: 1;
            text-align: center;
          }
          .tab .tab-item2{
            flex: 2;
            text-align: center;
          }
          .tab .tab-item3{
            flex: 3;
            text-align: center;
          }
          .tab div:hover{
            background: blue;
          }
        </style>
        <title>d</title>
      </head>
      <body>
    
        <div class="tab">
          <div class="tab-item1">
            apple
          </div>
          <div class="tab-item2">
            pear
          </div>
          <div class="tab-item3">
            orange
          </div>
        </div>
    
    
      </body>
    </html>
    
    You can change the world with your heart,even a lot of changes sometimes unless you won't geiv up....
  • 相关阅读:
    CSS——实现图像远距离翻转效果
    《精通CSS》一个下拉菜单的例子
    将博客搬至CSDN
    44个Java代码性能优化总结
    QRCode 二维码生成
    Linux命令
    spring
    ajax 学习总结
    Servlet+Ajax实现搜索框智能提示代码
    搜索框智能提示
  • 原文地址:https://www.cnblogs.com/xiongwei2017/p/6643731.html
Copyright © 2020-2023  润新知