微信小程序開發之搞懂flex布局2——flex container


容器的概念,是用來包含其它容器(container)和項目(item)。

flex container——flex容器

A flexbox layout is defined using the flex or inline-flex values of the display property on the parent item. This element then becomes a flex container, and each one of its children becomes a flex item.

給view(在小程序中用view,h5里用div)的display屬性設置為flex或inline-flex,這個view就成了flex容器,view里的元素就成了flex item。

 

A value of flex causes the element to become a block level flex container, and inline-flex an inline level flex container. These values create a flex formatting context for the element, which is similar to a block formatting context in that floats will not intrude into the container, and the margins on the container will not collapse with those of the items.

 

設置為display:flex時,是塊級彈性容器;設置為display:inline-flex時,是行內級彈性容器。


免責聲明!

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



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