CSS3盒模型display:box;box-flex:3;

來源:互聯網
上載者:User

標籤:容器   最大   tle   ever   bsp   port   blog   art   set   

<!DOCTYPE html><html><head>  <meta charset="utf-8">  <meta name="viewport" content="width=device-width">  <title>盒模型display:box;</title></head><body>    <article class="wrap">    <section class="section sectionOne">01</section>    <section class="section sectionTwo">02</section>    <section class="section sectionThree">03</section>  </article></body></html>
.wrap {  width: 600px;  height: 200px;  border: 1px solid #000000;  display: -webkit-box; /*這樣元素就會內聯化*/  display: -moz-box;  display: box;  -webkit-box-orient:horizontal;  -moz-box-orient:horizontal;  box-orient: horizontal;  -webkit-box-direction: reverse;  box-direction: reverse;  -webkit-box-align: center;  box-align: center;  /*子容器的水平對其方式*/  -webkit-box-pack: justify;}.section {  width: 50px;  height: 80px;}.sectionOne {  background: orange;  /*  -webkit-box-flex:1;  box-flex:1;  */}.sectionTwo {  background: purple;  /*  -webkit-box-flex:2;  box-flex:2;  */  /*margin: 0 50px;*/  height: 108px;}.sectionThree {  background: green;  width: 100px;}

注意:

給box設定vertical或block-axis屬性(此屬性是預設值)其效果似乎表現一致,
都可將子容器垂直排列,具體兩者有什麼實質差別暫時還沒有搞清楚。
如果父容器選擇vertical或block-axis屬性對子容器進行垂直排列,
其是對父容器的高度進行分配劃分。此時如果父容器定義了寬度值,
其子容器的寬度值設定則無效狀態;如果父容器不設定寬度值,
其子容器的寬度值才有效並且取最大寬度值的子容器的寬度。

 

效果:

 

CSS3盒模型display:box;box-flex:3;

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.