The Box-flex of CSS3 elastic box model

Source: Internet
Author: User

CSS3 Elastic Box Model Box-flex browser support

There is currently no browser support for the Box-flex property.

Firefox supports an alternative-moz-box-flex property.

Safari, Opera, and Chrome support alternative-webkit-box-flex genera

Box-flex is a newly added box model attribute of CSS3, which breaks the floating layout we often use to achieve vertical, horizontal, and proportional partitioning. However, it has some limitations, in Firefox, Chrome browser need to use their private properties to define: Firefox (-moz), Chrome (-webkit).

First, Box-flex properties

Box-flex mainly allows the child containers to be divided according to a certain rule for the width of the parent container.

<div class= "box" ><div class= "Col_1" >111</div><div class= "col_2" >222</div><div class= "Col_3" >333</div></div><style type= "Text/css" >.box {display:box;display:-webkit-box; Display:-moz-box;background-color: #fff; width:500px;height:100px;border:1px solid #333; margin:0 Auto;}. Col_1 {box-flex:1;-moz-box-flex:1;-webkit-box-flex:1;background-color: #ffc;}. col_2 {background-color: #ccf; box-flex:2;-moz-box-flex:2;-webkit-box-flex:2;}. Col_3 {background-color: #fcf; box-flex:2;-moz-box-flex:2;-webkit-box-flex:2;} </style>

 Note : The above is divided by proportional number, if one or more of the sub-container set fixed width, the other child containers are not set, then set the width of the width to calculate, the rest of the method is calculated as above.

. col_3 {background-color: #fcf; width:50px;/* set width to 50px*/}

When there are gaps in the sub-containers, they divide the width by subtracting the middle margin and then splitting them equally.

. col_2 {background-color: #ccf; box-flex:2;-moz-box-flex:2;-webkit-box-flex:2;margin:0 20px;}

Second, the Box property of the Box property includes:
Box-orient, Box-direction, Box-align, Box-pack, Box-lines

The specific usage of the property value can refer to the document

The Box-flex of CSS3 elastic box model

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.