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

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

flex container——flex容器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.flexbox

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

 

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.element

 

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

相關文章
相關標籤/搜索