css 彈性盒子--“垂直居中”--兼容寫法


使用彈性盒子兼容低端適配有時需要:

display:flex 和 display:-webkit-box

 

      display: -webkit-box;
      -webkit-box-align: center;
      -webkit-box-pack: center;

      display: flex;
      align-items: center;
      justify-content: center;

 

對應屬性:

彈性盒子:

   display: -webkit-box;
   display: flex;

 

上下垂直

    -webkit-box-align: center;
      align-items: center;

 

左右居中

    -webkit-box-pack: center;
     justify-content: center;

 

占父級元素寬度的n份

 -moz-box-flex:3;
 -webkit-box-flex:3;
 -webkit-flex:3;
 flex:3;

 

父元素設置子元素 倒序

 display: -webkit-box;
 display: flex;

 -webkit-box-direction:reverse;
 box-direction:reverse;
 flex-direction: row-reverse

 

父元素設置子元素排序

 display: -webkit-box;
 display: flex;

 flex-direction: column;   /**/
      
 box-orient: vertical;
 -webkit-box-orient: vertical; 

 

父元素設置子元素 排序

   display: -webkit-box;
   display: flex;

   flex-direction: row;   /**/
      
   box-orient: horizontal;
   -webkit-box-orient: horizontal; 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM