Home > Web Front-end > CSS Tutorial > What is the difference between flex layout and traditional layout?

What is the difference between flex layout and traditional layout?

王林
Release: 2020-06-20 17:02:35
forward
3782 people have browsed it

What is the difference between flex layout and traditional layout?

What is the difference between flex layout and traditional layout?

Traditional layout: based on the box model, relying on the display attribute, position attribute, and float attribute;

flex layout: flex is the abbreviation of flexible Box, meaning "flexible layout", used to provide maximum flexibility for box models.

(Recommended tutorial: css quick start)

The element set to display: flex is called a "container", and its child elements are called "items". It should be noted that after the container is set to flex layout, the float, clear and vertical-align attributes of the child elements will be invalid;

Why do we need to determine the main axis and side axis?

The main axis and side axis are determined by flex-direction (default is row) The reason why the main axis must be determined is to determine the alignment direction of the item:

If flex-direction is row or row-reverse, then the main axis is justify-content;

If flex-direction is column or column-reverse, then the main axis is align-items.

The above is the detailed content of What is the difference between flex layout and traditional layout?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:juejin.im
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