Home>Article>Web Front-end> What are the advantages of HTML5 flexible layout?

What are the advantages of HTML5 flexible layout?

青灯夜游
青灯夜游 Original
2021-03-23 14:18:08 2797browse

HTML5 flexible layout is used to provide maximum flexibility for the box model. The advantage is that it is easy to use and it is easy to achieve a certain layout effect according to flex rules. Any container can be designated as Flex layout.

What are the advantages of HTML5 flexible layout?

The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.

Flexible layout (Flexible Box or flexbox) is a layout method that ensures that elements have appropriate behavior when the page needs to adapt to different screen sizes and device types.

The purpose of introducing the flexible box layout model is to provide a more efficient way to arrange, align and allocate empty space to sub-elements in a container.

Advantages and disadvantages of flex layout:

The advantage is that it is easy to use and it is easy to achieve a certain layout effect according to flex rules.

The disadvantage is: the browser compatibility is relatively poor and can only be compatible with ie9 and above.

[Recommended tutorial:CSS video tutorial]

Flexible box content

Flexible box by It is composed of Flex container and Flex item.

A flexible container is defined as a flexible container by setting the value of the display property to flex or inline-flex.

The flexible container contains one or more flexible sub-elements.

Note: The outside of the flexible container and inside the flexible sub-element are rendered normally. The flex box only defines how the flex child elements are laid out within the flex container.

Flexible sub-elements are usually displayed in one line within the flexible box. By default there is only one row per container.

The following elements show the flexible sub-elements displayed in a row, from left to right:

      FLEX  

What are the advantages of HTML5 flexible layout?

Common properties of flexible boxes

##flex-direction Specify Arrangement of child elements in a flexible container flex-wrap Set whether to wrap the child elements of the flexible box when they exceed the parent container flex-flow Abbreviation for flex-direction and flex-wrap align-items Set the flex box element on the side axis (vertical axis) direction align-content Modify the behavior of the flex-wrap attribute, similar to align-items, but instead of setting the alignment of child elements, Set row alignment justify-content Set the alignment of the flexible box element in the main axis (horizontal axis) direction
Attribute Description
For more programming-related knowledge, please visit:

Programming Video! !

The above is the detailed content of What are the advantages of HTML5 flexible layout?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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