当前位置:网站首页>Flex layout
Flex layout
2022-07-26 18:41:00 【qq_ forty-eight million six hundred and thirty-nine thousand tw】
flex Layout / Elastic layout / Expansion box
use flex Layout elements , be called Flex Containers (flex container), abbreviation " Containers ". All its child elements automatically become container members , be called Flex project (flex item), abbreviation " project ".
Container attribute :
flex-dircetion ( Change the spindle arrangement direction )
flex-wrap ( Line break )
flex-flow(flex-direction and flex-wrap Abbreviation for property )
justify-content( Set spindle alignment )
align-items ( Set the alignment of the cross axes )
align-content ( Set multiline alignment )
Elastic element properties :
order ( Control the order of elements , The smaller the value, the higher the value , The default is 0
flex-grow( Decide whether to enlarge the project when there is space left , The default is 0)
flex-shrink( Decide whether to shrink when the project space is insufficient , The default is 1)
flex-basis( Sets the width of the elastic element basis Priority ratio width high )
align-self( Set the cross axis alignment of the elastic element itself )
flex(flex-grow and flex-shrink and flex-basis Abbreviation The default value flex:0 1 auto)
Horizontal center
- display:flex justify-content:center align-items:center
- display:grid justify-content:center align-items:center
- display:flex Subelement margin:auto
Container attribute
The elastic elements are arranged along the main axis
flex-direction:row( Default ) | row-reverse | column | column-reverse Change the spindle arrangement direction

Line break
flex-wrap: nowrap( Default ) | wrap | wrap-reverse Default no line breaks , If the elastic element exceeds the width of the parent container , Isoproportional compression
flex-flow: row nowrap Default
yes flex-direction and flex-wrap Short form of property



Set spindle alignment
justify-content:flex-start( Default ) | flex-end | center | space-between | space-around | space-evenly
Cross axis alignment
align-items:flex-start | flex-end | center | baseline | stretch( Default )



space-between For left and right alignment , That is, the items on the left and right sides are close to the container , And the distance between items is equal .

space-around The space between items is the space between items on the left and right sides to the container 2 times , A special layout , Not much in daily use .

space-evenly It means that the distance between items is equal to the distance between items and containers , It's equivalent to removing the project width , The remaining width is evenly allocated as the left and right of the project margin.

stretch tile , Default cross axis attribute , If the elastic element height is not set /auto.
Baseline alignment baseline Text alignment

Set multiline alignment
align-content: flex-start | flex-end | center | space-between | space-around | space-evenly | stretch( Default )

space-around And justify-content bring into correspondence with , That is, the distance between the items is twice the distance between the items at the upper and lower ends and the container .

space-evenly Empathy , The distance between items is equal to the distance between items and containers ,space-between Keep the upper and lower side items close to the container .


Elastic element properties
Control the order of elements
order: Default 0, The smaller the value, the higher the value

Decide whether to enlarge the project when there is space left
flex-grow: The container will not be occupied by default when there is free space

Decide whether the project will shrink when space is insufficient
flex-shrink The default is 1 Isoproportional compression
flex-basis Default auto, Sets the width of the elastic element basis Priority ratio width high

Take up the rest of the space
flex: Default 0 1 auto,flex The attribute is flex-grow,flex-shrink And flex-basis Shorthand for three attributes

Cross axis alignment
align-self: auto( Default ) | flex-start | flex-end | center | baseline | stretch, Represents the... That inherits the parent container align-items attribute . If there is no parent element , By default stretch.

边栏推荐
- LeetCode_ 1005_ Maximized array sum after K negations
- 链表-合并两个排序的列表
- Shader code of parallax map in OpenGL
- Visual VM 定位OOM,FullGC使用方法
- Pyqt5 rapid development and practice 3.5 menu bar and toolbar
- Download and configuration of irrklang audio library
- 神经网络学习(2)前言介绍二
- PyQt5快速开发与实战 3.5 菜单栏与工具栏
- Linked list - the first common node of two linked lists
- Ministry of Finance: IC design enterprises and software enterprises will be exempted from corporate income tax this year and next!
猜你喜欢

Redis持久化RDB/AOF

offer-集合(1)

14. Gradient detection, random initialization, neural network Summary

Leetcode 50 day question brushing plan (day 1 - add two numbers 11.00-12.30)

ALV screen input option learning

Are you suitable for automated testing?

flex布局

Maximum sum of continuous subarray of sword finger offer (2)
![[ Kitex 源码解读 ] 服务发现](/img/70/c74ede02b794e586d629876d2b2376.png)
[ Kitex 源码解读 ] 服务发现

The pit of mpc5744p reports an error, RTOS cannot be started, and there is a clock source problem
随机推荐
模块八作业 - 消息数据 MySQL 表设计
How to assemble a registry
Offer set (1)
Visual VM 定位OOM,FullGC使用方法
文件上传下载测试点
分布式链路追踪Jaeger在Golang中的使用
Flask 封装七牛云
J9数字论:如何避免踩雷多头陷阱?
Sign up now | cloud native technology exchange meetup Guangzhou station has been opened, and I will meet you on August 6!
网易游戏研发工程师实习生(客户端方向)一面
Linked list - the penultimate K nodes
Leetcode 50 day question brushing plan (day 2 - the longest substring without repeated characters 10.00-12.00)
How the test team conducts QA specification
Leetcode 50 day question brushing plan (day 5 - longest palindrome substring 10.50-13:00)
Online stock trading, where to choose to open an account is safer?
深入理解为什么不要使用System.out.println()
PS_ 1_ Know the main interface_ New document (resolution)_ Open save (sequence animation)
Data security knowledge system
隐私计算基础组件系列-混淆电路
During the oppo interview, 16 questions were thrown over. I was stupid