微信小程序开发之搞懂flex布局2——flex container

2023-06-12,,

容器的概念,是用来包含其它容器(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时,是行内级弹性容器。

微信小程序开发之搞懂flex布局2——flex container的相关教程结束。

《微信小程序开发之搞懂flex布局2——flex container.doc》

下载本文的Word格式文档,以方便收藏与打印。