Home > WeChat Applet > Mini Program Development > WeChat Mini Program-What is Flex Layout?

WeChat Mini Program-What is Flex Layout?

云罗郡主
Release: 2019-01-21 11:56:02
forward
4031 people have browsed it

Flex is the abbreviation of Flexible Box, which means "flexible layout" and is used to provide maximum flexibility for box-shaped models. [Recommended tutorial: 小program development tutorial]

Any container can be designated as Flex layout.

.box{ display: flex; }
Copy after login

Inline elements can also use Flex layout.

.box{ display: inline-flex; }
Copy after login

Browsers with Webkit core must add the -webkit prefix.

.box{ display: -webkit-flex; /* Safari */ display: flex; }
Copy after login

Note that after setting to Flex layout, the float, clear and vertical-align attributes of child elements will be invalid.

Basic concepts of Flex
Elements that adopt Flex layout are called Flex containers (flex containers), referred to as "containers". All its child elements automatically become container members, called Flex items (flex items), or "items" for short.

WeChat Mini Program-What is Flex Layout?

Containers have two axes by default: the horizontal main axis (main axis) and the vertical cross axis (cross axis). The starting position of the main axis (the intersection with the border) is called main start, and the ending position is called main end; the starting position of the cross axis is called cross start, and the ending position is called cross end.

Items are arranged along the main axis by default. The main axis space occupied by a single item is called main size, and the cross axis space occupied by a single item is called cross size.

Container properties

 flex-direction: The property determines the direction of the main axis (that is, the arrangement direction of items). (Left, middle, right, top, middle, bottom)

 flex-wrap: Attribute definition, if one axis line cannot be arranged, how to wrap the line.

 flex-flow: The short form of the flex-direction property and the flex-wrap property, the default value is row nowrap

 justify-content: The property defines the alignment of the item on the main axis . (Left, center, right)

 align-items: Property defines how items are aligned on the cross axis. (Top, middle and bottom)

 align-content: The attribute defines the alignment of multiple axes. This property has no effect if the project has only one axis.



The above is the detailed content of WeChat Mini Program-What is Flex Layout?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template