zoukankan      html  css  js  c++  java
  • flex布局

     一、flex基础属性:http://www.ruanyifeng.com/blog/2015/07/flex-grammar.html

    1、display:flex;

         行内元素:display:inline-flex

         webkit内核:display:-webkit-flex;

                              display:flex;

       **设为flex后,子元素的float、clear、vertical-align将失效

    2、基本概念

       方向: flex-direction: row | row-reverse | column | column-reverse;、

      是否换行:flex-wrap: nowrap | wrap | wrap-reverse;

       flex-flow:<flex-direction?>||<flex-wrap>

       justify-content:flex-start|felx-end|center|space-between|space-around;

       align-items:flex-start|flex-end|center|baseline|stretch;

       align-content:flex-start|flex-end|center|space-between|space-around|stretch;

    3、项目属性

       order:排列顺序、数值越小、排列越靠前、默认0

       flex-grow:放大比例、默认0,如果存在剩余空间、也不放大

       flex-grow:<number>

       flex-shrink:缩小比例

        flex-basis

        align-self:auto|flex-start|flex-end|center|baseline|stretch;//润需单个与其他的不一样

      二、flex简单布局:http://www.ruanyifeng.com/blog/2015/07/flex-examples.html

       1、单个项目

           水平方向上:

           display:flex

           display:flex;

           justify-content:center;

         

           display:flex;

           justify-content:end;

           一个元素,垂直居中

           dispaly:flex;

           justify-content:center;

           align-items:center;

           display:flex;

           justify-content:center;

           align-items:end;

           

           display:flex;

           justify-content:flex-end;

           align-items:flex-end;

      

          2、双项目

            display:flex;

            justify-content:space-between;

            display:flex;

            flex-direction:column;

            justify-content:space-between;

      

            display:flex;

            flex-direction:column;

            justify-content:space-between;

            align-items:center;

            display:flex;

            flex-direction:column;

            justify-content:space-between;

            align-items:flex-end;

        

    .box {
      display: flex;
    }
    
    .item:nth-child(2) {
      align-self: center;
    }

      

    .box {
      display: flex;
      justify-content: space-between;
    }
    
    .item:nth-child(2) {
      align-self: flex-end;
    }


    .box {
      display: flex;
    }
    
    .item:nth-child(2) {
      align-self: center;
    }
    
    .item:nth-child(3) {
      align-self: flex-end;
    }


    .box {
      display: flex;
      flex-wrap: wrap;
      justify-content: flex-end;
      align-content: space-between;
    }

          

           

              

       

  • 相关阅读:
    解决web服务器乱码问题
    Reporting services 打印
    moss用户管理
    乱弹超级女声。。。。。。。。。。。。
    微软项目管理[EPM]数据库应用举例1: 找到所有正在进行的项目
    ajax中另一种装载数据页面的方法
    微软项目管理[EPM]数据库剖析4:项目大纲代码的四张表
    微软项目管理[EPM]数据库应用举例2: 取得一个项目的某大纲代码的值
    支持多表头、滚动条可排序的DataGrid控件[Free]
    微软项目管理[EPM]数据库剖析3:如何取得某个项目的某个大纲代码的值
  • 原文地址:https://www.cnblogs.com/lmxxlm-123/p/8884780.html
Copyright © 2011-2022 走看看